3 Go to Developer's tab > click on "Visual Basic" button or hit Alt + F11.
4 Go to Insert tab > click on "Module" or hit M.
5 Copy the VBA code from below.
6 Paste the code in the newly created module.
7 Go to Run tab > click on "Run Sub/UserForm" or hit F5.
8 That's it!
Advertisement
Code
'==========================================
' Determine Hidden Rows And Columns
'==========================================
Sub determineHiddenRowsColumns()
' Set variables
Dim i As Long
Dim strAddress As String
Dim strRows As String
Dim strColumns As String
Dim appWorksheetFunction As WorksheetFunction
' Set reference to the function
Set appWorksheetFunction = Application.WorksheetFunction
' Determine the hidden rows
For i = 1 To 1048576
If Rows(i).Hidden Then
strRows = strRows & " " & i
End If
Next i
' Determine the hidden columns
For i = 1 To 16384
If Columns(i).Hidden Then
strAddress = Columns(i).Address(False, False)
strColumns = strColumns & " " & Left(strAddress, appWorksheetFunction.Find(":", strAddress) - 1)
End If
Next i
' Return a message
If strColumns <> "" Or strRows <> "" Then
MsgBox "Row(s): " & strRows & Chr(13) & _
"Column(s): " & strColumns
Else
MsgBox "There are no hidden rows or columns."
End If
' Release the function
Set appWorksheetFunction = Nothing
End Sub