Delete hidden columns in a worksheet

This tutorial shows how to delete only the hidden columns in a specific worksheet at once using VBA

METHOD 1. Delete hidden columns in a worksheet

VBA

Sub Delete_Hidden_Columns()
'declare a variable
Dim ws As Worksheet
Application.ScreenUpdating = False
Set ws = Worksheets("Sheet1")
ws.Activate
For numcol = 1 To Rows.Count
If Columns(numcol).EntireRow.Hidden = True Then
Columns(numcol).EntireRow.Delete
Else
End If
Next numcol
Application.ScreenUpdating = True

End Sub

ADJUSTABLE PARAMETERS
Worksheet Selection: Select the worksheet in which you want to delete all hidden columns by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name 'ws' in the VBA code.
ADDITIONAL NOTES
Note 1: This macro will loop through each column in a specific worksheet and delete all hidden columns.

Explanation about how to delete hidden columns in a worksheet

EXPLANATION

EXPLANATION

This tutorial shows how to delete only hidden columns in a specific worksheet at once by using VBA.
The macro will loop through each row in a specific worksheet and identify if the column is hidden. If it identifies that a column is hidden it will delete it. Please note that given the macro will be looping through each cell in a specific worksheet it might take a while until it can complete the task.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to delete only the hidden rows in a specific worksheet at once
How to delete all hidden rows and columns in a workbook at once
How to delete all hidden rows and columns in a specific worksheet at once