Hi Everyone,
I got a VBA code from google and it works fine. However, I need to hide blank rows only in a specific range and the code below hide the entire range of rows. Thus anyone can amend the code below for my specific requirement? For example, I have a data from C4 to C10 and by doing so the blank rows from C11 to C15 will be hidden and by clicking again it will unhide.
Private Sub CommandButton1_Click()
If CommandButton1.Caption = "Hide Blank Rows" Then
Range("C4:C15").EntireRow.Hidden = True
CommandButton1.Caption = "Show Blank Rows"
Else
Range("C4:C15").EntireRow.Hidden = False
CommandButton1.Caption = "Hide Blank Rows"
End If
End Sub
Many thanks,
Nhinx
I got a VBA code from google and it works fine. However, I need to hide blank rows only in a specific range and the code below hide the entire range of rows. Thus anyone can amend the code below for my specific requirement? For example, I have a data from C4 to C10 and by doing so the blank rows from C11 to C15 will be hidden and by clicking again it will unhide.
Private Sub CommandButton1_Click()
If CommandButton1.Caption = "Hide Blank Rows" Then
Range("C4:C15").EntireRow.Hidden = True
CommandButton1.Caption = "Show Blank Rows"
Else
Range("C4:C15").EntireRow.Hidden = False
CommandButton1.Caption = "Hide Blank Rows"
End If
End Sub
Many thanks,
Nhinx