VBA to unfilter all columns

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
1,756
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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,743
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,743
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,113,836
Messages
5,544,596
Members
410,624
Latest member
smartsanjiv64
Top