VBA to unfilter all columns

gheyman

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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,746
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,746
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,114,325
Messages
5,547,263
Members
410,783
Latest member
sonnny
Top