Hi everyone,
I'm trying to make a macro that checks column "Sun" on my table "Table1" to see if there is a filtered applied, if there is not I want to apply this filter. I'm also trying to make the macro dynamic by searching column headers to find the right column since my table changes.
This is what I have so far but was hoping someone could lead me in the right direction.
All this macro does so far is apply the filter, how do I add in the checking to see if the filter is applied part? I've tried to search but I've only found answers that don't apply to tables.
Thank you in advance!
I'm trying to make a macro that checks column "Sun" on my table "Table1" to see if there is a filtered applied, if there is not I want to apply this filter. I'm also trying to make the macro dynamic by searching column headers to find the right column since my table changes.
This is what I have so far but was hoping someone could lead me in the right direction.
VBA Code:
Dim lo As ListObject
Dim iCol As Long
Set lo = Sheet1.ListObjects(1)
iCol = lo.ListColumns("Sun").Index
lo.Range.AutoFilter Field:=iCol, Criteria1:="<>"
All this macro does so far is apply the filter, how do I add in the checking to see if the filter is applied part? I've tried to search but I've only found answers that don't apply to tables.
Thank you in advance!