Delete hidden rows and columns in a workbook
This tutorial shows how to delete all hidden rows and columns in a workbook at once using Excel or VBA
METHOD 1. Delete hidden rows and columns in a workbook
EXCEL
Select File tab > Select Info > Click Check for Issues > Click Inspect Document > Click Inspect > Scroll to Hidden Rows and Columns > Click Remove All
1. Select the File tab. |
2. Select Info. |
3. Click on Check for Issues. 4. Click on Inspect Document. |
5. Click on Inspect. |
6. Scroll to the Hidden Rows and Columns section and click on Remove All. |
METHOD 1. Delete hidden rows and columns in a workbook
VBA
Sub Delete_Hidden_Rows_Columns()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
ws.Activate
For numcol = 1 To Columns.Count
If Columns(numcol).EntireColumn.Hidden = True Then
Columns(numcol).EntireColumn.Delete
Columns(numcol).EntireColumn.Delete
Else
End If
Next numcol
For numrow = 1 To Rows.Count
If Rows(numrow).EntireRow.Hidden = True Then
Rows(numrow).EntireRow.Delete
Rows(numrow).EntireRow.Delete
Else
End If
Next numrow
Next ws
Application.ScreenUpdating = True
End Sub
ADDITIONAL NOTES
Note 1: This macro will loop through each column and row in each of the sheets and delete the columns and rows that are hidden.
Note 1: This macro will loop through each column and row in each of the sheets and delete the columns and rows that are hidden.
EXPLANATION
This tutorial shows how to delete all hidden rows and columns in a workbook by using Excel or VBA.
The macro will loop through each row and column in each of the worksheets in a workbook and identify if the row or column is hidden. If it identifies that a row or column is hidden it will delete it. Please note that given the macro will be looping through each cell in a workbook it might take a while until it can complete the task.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Delete all Pictures and Objects in a workbook | How to delete all pictures and objects from an entire workbook at once |