Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code to unfilter if filtered
The code below works. It selects a filtered range and unfilters it.
Dim WSNames As Worksheet Dim rng As Range Set WSNames = Sheets("Names") Set rng = WSNames.Range(WSNames.Range("A1"), WSNames.Range("C1").End(xlDown)) WSNames.Select rng.Select ActiveSheet.ShowAllData However, occassionally the data is not filtered at all. If the data is in autofiltermode but nothing is filtered then it gives me an error at the "ActiveSheet.ShowAllData" line. I guess I need an If Then that will correct this??? -- Thanks Shawn |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code to unfilter if filtered
Dim WSNames As Worksheet
Dim rng As Range Set WSNames = Sheets("Names") Set rng = WSNames.Range(WSNames.Range("A1"), WSNames.Range("C1").End(xlDown)) WSNames.Select rng.Select if ActiveSheet.FilterMode then ActiveSheet.ShowAllData End if -- Regards, Tom Ogilvy "Shawn" wrote: The code below works. It selects a filtered range and unfilters it. Dim WSNames As Worksheet Dim rng As Range Set WSNames = Sheets("Names") Set rng = WSNames.Range(WSNames.Range("A1"), WSNames.Range("C1").End(xlDown)) WSNames.Select rng.Select ActiveSheet.ShowAllData However, occassionally the data is not filtered at all. If the data is in autofiltermode but nothing is filtered then it gives me an error at the "ActiveSheet.ShowAllData" line. I guess I need an If Then that will correct this??? -- Thanks Shawn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
unfilter | Excel Discussion (Misc queries) | |||
Filtered rows not in code??? | Excel Programming | |||
excel should let me unfilter all columns with one click | Excel Programming | |||
Code to unfilter one field only | Excel Programming | |||
Unfilter | Excel Programming |