Can you delete all hidden columns in an area in one move?

G

Gizmofied

I am wondering if it is possible in Excel to permanently delete all hidden
columns in an area of a worksheet with one move (without having to unhide
every column and then manually delete each column)?
 
J

Jim Rech

This might do it. Tested lightly<g>

Sub DelAllHiddenCols()
Dim Col As Range
Dim DelCols As Range
For Each Col In Rows(1).EntireColumn
If Col.Hidden Then
If DelCols Is Nothing Then
Set DelCols = Col
Else
Set DelCols = Union(DelCols, Col)
End If
End If
Next
If Not DelCols Is Nothing Then DelCols.Delete
End Sub
 
Top