0

I have a validation box that has stored in it a number of sales channels i.e "SME100", "Indirect" etc...

Now I have an auto filtering system set up but I want to create an event that states, "when cell "B2" changes then activate 'Auto_Filter'".

Here is what I currently have. It doesn't return an error message but when I test it on the front end it doesn't run the macro either.

Private Sub CellChangeFilter()

Dim Tariff_Selection As String
    Set Tariff_Selection = Cell("B1")

If Tariff_Selection = "" Then Auto_Filter

End Sub

As you can see I have created a variable for the specific cell that I want the event to monitor.

Community
  • 1
  • 1
Peter Mogford
  • 478
  • 1
  • 4
  • 15

1 Answers1

1

As mentioned, Worksheet_Change is what you want. Try this:-

Private Sub Worksheet_Change(ByVal Target As Range)

   If (Target.Address = Range("B2").Address) Then

     Debug.Print "Cell B2 was edited in some way"

     Auto_Filter

   End If

End Sub
joehanna
  • 1,471
  • 1
  • 11
  • 22