Deleting all the hidden rows and columns in the active worksheet using VBA


This content was proof-read by Grammarly. You can Try Grammary for FREE

Do you want to delete all the hidden rows and columns in the active worksheet in Microsoft Excel using VBA ?. Here’s the code snippet that helps you to do it.

How to delete all the hidden rows and columns in Active Worksheet using VBA in Microsoft Excel ?

Sub DeleteHiddenSheets()
    For i = 256 To 1 Step -1
    If Columns(i).EntireColumn.Hidden = True Then Columns(i).EntireColumn.Delete Else
    Next
    For i = 65536 To 1 Step -1
    If Rows(i).EntireRow.Hidden = True Then Rows(i).EntireRow.Delete Else
    Next
End Sub
%d bloggers like this: