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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,745
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,745
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,066
Messages
5,545,790
Members
410,706
Latest member
antstt
Top