-I am wanting to control the filter on a block of data via VB
-I want to use a defined name instead of stating what the filter should be set to
- My defined name points to a cell that is linked to a drop down box (so when the drop down is changed the name in the defined name cell changes and thus resets the filters).
So I could write:
Sub Test_Filter()
Name1 = ActiveWorkbook.Sheets("Look Ups").Range("I139").Value
If Name1 = "Bebo" Then ActiveWorkbook.Sheets("Graph Data - All").Range("$A$58:$D$3052").AutoFilter Field:=3, Criteria1:= _
"Bebo"
Else If = "Facebook" Then ActiveWorkbook.Sheets("Graph Data - All").Range("$A$58:$D$3052").AutoFilter Field:=3, Criteria1:= _
"Facebook"
End Sub
But what I really want to do is:
Sub Test_Filter()
Name1 = ActiveWorkbook.Sheets("Look Ups").Range("I139").Value
ActiveWorkbook.Sheets("Graph Data - All").Range("$A$58:$D$3052").AutoFilter Field:=3, Criteria1:= _
"Name1"
End Sub
The reason for this is that this is a monthly report and the variables I want to filter by will change every month and I don't want to have to go back into the code each month and re-enter all the sites.
Any suggestion would be much appreciated.


