How can I use structured references to a column in an Excel macro?
- by Eshwar
Here's an example that will explain things:
Sheets("Plot Data July").Select
ActiveSheet.ListObjects("tPDJuly").Range.AutoFilter Field:=2
ActiveSheet.ListObjects("tPDJuly").Range.AutoFilter Field:=4
So as you can see above, Field:=2 is a relative reference to the second field in the table called "tPDJuly". So now if I add more columns, this number does not get updated. The field is actually called "Grade" in the table. So is there a way of coding this so that no matter which column it is in, "Grade" is always updated?
I suppose one solution is that we add a line that find what is the column number for "Grade"?