VBA to unfilter all columns

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
1,744
Office Version
  1. 365
Platform
  1. Windows
Is there a way to unfilter columns using code? I have code that chokes if the user has any filters on. I want to in-filter all before my code runs.
 

Some videos you may like

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,722
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
Try for columns: ActiveSheet.Columns.Hidden = False
For rows: ActiveSheet.Rows.Hidden = False
For both: ActiveSheet.Cells.Hidden = False
 
Last edited:

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,722
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows
My ActiveSheet.Cells.Hidden = False is wrong :(
More correct:
Rich (BB code):
Sub UnhideColumns()
  ActiveSheet.Columns.Hidden = False
End Sub
 
Sub UnhideRows()
  If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData
  ActiveSheet.Rows.Hidden = False
End Sub
 
Sub UnhideAll()
  UnhideColumns
  UnhideRows
End Sub
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,109,489
Messages
5,529,168
Members
409,853
Latest member
Amy Gassett
Top