ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can you delete all hidden columns in an area in one move? (https://www.excelbanter.com/excel-discussion-misc-queries/69077-can-you-delete-all-hidden-columns-area-one-move.html)

Gizmofied

Can you delete all hidden columns in an area in one move?
 
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)?

Jim Rech

Can you delete all hidden columns in an area in one move?
 
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


--
Jim
"Gizmofied" wrote in message
...
|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)?



Gizmofied

Can you delete all hidden columns in an area in one move?
 
Thank you - I will try this out.

"Jim Rech" wrote:

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


--
Jim
"Gizmofied" wrote in message
...
|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)?





All times are GMT +1. The time now is 09:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com