Cellardoor
Member
Dear all
I have this code to autofilter my list object
Range("Table1[[#Headers],[Unit]]").Select
Selection.AutoFilter
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, _
Criteria1:="Company1"
But i will need to reply this code many times so i would ask you if its possible to Define this criteria only in the beginning of the Macro. If so, i would only need to change the criteria one time.
Something like this:
Set Criteria as Criteria 1
Criteria = Company1
In my code i would only have:
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, _
Criteria1:="Criteria"
And by this i would only need to change the Company1 to Company2 or Company3 one time.
Is it clear?
Many Thanks
I have this code to autofilter my list object
Range("Table1[[#Headers],[Unit]]").Select
Selection.AutoFilter
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, _
Criteria1:="Company1"
But i will need to reply this code many times so i would ask you if its possible to Define this criteria only in the beginning of the Macro. If so, i would only need to change the criteria one time.
Something like this:
Set Criteria as Criteria 1
Criteria = Company1
In my code i would only have:
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, _
Criteria1:="Criteria"
And by this i would only need to change the Company1 to Company2 or Company3 one time.
Is it clear?
Many Thanks