0

I am having an issue making a continuous macro work. I have a filter set on a 'dashboard' sheet, which pulls information from a different sheets. I would like the macro to auto run, continuously updating the filter when ever the cells in the source sheet update. My code is below: what needs amending? thanks so much. (S&P500 is source sheet. Dashboard is sheet with the Macro on)

    Sub Yes ()
    '
    ' Yes Macro
    '
    'Private Sub S&P500Stocks_Activate()
        ActiveSheet.Range("$A$1:$E$499").AutoFilter Field:=1, Criterial:="Yes", _
             Operator:=xlAnd
    'Private Sub S&P500Stocks_Change(ByVal Target As Range)
        ActiveSheet.Range("$A$1:$E$499").AutoFilter Field:=1, Criterial:="Yes", _
             Operator:=xlAnd
    End Sub

Help would be awesome

1 Answer 1

1

First make sure Sub Yes() is in a Standard Module rather than on a worksheet.
Second change ActiveSheet to Sheets("S&P500")
Third make Sub Yes() Public

Then to go the worksheet code area for Sheets("S&P500") and install this event macro:

Private Sub Worksheet_Change(ByVal Target As Range)
   Application.EnableEvents = False
      Call Yes
   Application.EnableEvents = True
End Sub
Sign up to request clarification or add additional context in comments.

5 Comments

I am however a bit of a novice.
How do I make sure something is a standard module rather than a worksheet? How do I make Yes public? thanks so much!!
I have got all the above auto working now. If I have set another sheet up with a macro that I want to run continuously using the same worksheets but different info within them. If I use the code: Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False Call Yes Application.EnableEvents = True End Sub
Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False Call Yes Application.EnableEvents = True Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False Call Dboard 2 Application.EnableEvents = True End Sub
For some reason it is showing an error....When trying to have two commands like this in the worksheet event macro....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.