Good afternoon
I'm looking for a way to make the field of an autofilter dynamic - for example:
Range("a1:J" & LRow ).autofilter Field:=7, Criteria1:=""
If someone were to add a column between B&C, the field would now need to be 8, but the code won't register this.
I've thought about maybe doing something like:
Dim ColRef as long
ColRef=worksheetfunction.match( [whatever col G header ref is].sheets("sheet1"). Range("A1:J1).0)
But as I'll be putting quite a few filters at various places in the code I'm wondering if there's another way?
I'm looking for a way to make the field of an autofilter dynamic - for example:
Range("a1:J" & LRow ).autofilter Field:=7, Criteria1:=""
If someone were to add a column between B&C, the field would now need to be 8, but the code won't register this.
I've thought about maybe doing something like:
Dim ColRef as long
ColRef=worksheetfunction.match( [whatever col G header ref is].sheets("sheet1"). Range("A1:J1).0)
But as I'll be putting quite a few filters at various places in the code I'm wondering if there's another way?