Run Macro Sequence On Set Cell Changed By Drop-Down

  • Hi


    I have found a macro that should work with a change of a specific cell.

    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Address = "$A$7" Then
         Call Button
        End If
    End Sub



    However, the code doesn t work as with a change of A7 nothing happens.
    A7 equals to result from a drop down list --> A7=A5(which is a drop down list value).
    The "Button" macro is a combination of 4 macros that get rid of zero values and names in pie charts (maybe this plays any role). The master macro is assigned to an object. The code is:


  • Re: Run Chart Macro On Set Cell Changed By Drop-Down


    Try;

    Code
    Private Sub Worksheet_Change(ByVal Target As Range) 
        If Target.Address = "$A$7" Then 
            Run "Button"
        End If 
    End Sub

    Where the "Button" is in a Pulic Module as;

    Code
    Sub Button()
    Run "Button1"
    Run "Button2"
    'You get the idea...
    End Sub
  • Re: Run Macro Sequence On Set Cell Changed By Drop-Down


    Quote from Dave Hawley

    Insert>Module while in the VBE


    The Sheet & ThisWorkbook Modules are Private.


    I don't think any modules are Private by default, in fact they are not private at all in the context of how stated I believe.


    The procedures in a Sheet and ThisWorkbook module may be private by default, but they can be changed to Public very easily, and other public procedures can be inserted within these modules. Referring to these procedures may need to be qualified with the module name, but it is very easily done.


    Private modules only refers to modules that are private to the Project, not per se, and that can apply to any module, including general modules.

    HTH


    Bob

  • Re: Run Macro Sequence On Set Cell Changed By Drop-Down


    Ok, Procedures used in Object Modules should be private to the Object.


    I still believe Sheet and Thisworkbook Modules are Private as the use of Me refers to that Object and you MUST state the sheet name for a named range in a sheet module IF the named range is not on the same sheet.

  • Re: Run Macro Sequence On Set Cell Changed By Drop-Down


    Boys, this has very little to do with the thread - perhaps you should make a new thread to discuss semantics...


    :wink:

  • Re: Run Macro Sequence On Set Cell Changed By Drop-Down


    IMO it does, because the OP might get the wrong impression as to what he can and what he cannot do with Sheet modules and ThisWorkbook. It may not be a direct respones to his question, but it does extend the information.

    HTH


    Bob

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!