Delete All Hidden Columns and Rows – VBA Excel – Code

This VBA code can help you delete all hidden columns and rows from your excel sheet with a click of a button.

Sub hiddendelete()
For lp = 256 To 1 Step -1 'loop through all columns
If Columns(lp).EntireColumn.Hidden = True Then Columns(lp).EntireColumn.Delete Else
Next
For lp = 65536 To 1 Step -1 'loop through all rows
If Rows(lp).EntireRow.Hidden = True Then Rows(lp).EntireRow.Delete Else
Next
End Sub