I have written the below code to hide blank rows within the used range of a worksheet. The code works perfectly fine. I have assigned this macro to a button on the worksheet. Clicking the button hides the blank rows within the used range.
Question: How do I modify the code so that clicking this same button does the reverse? If the blank rows are unhidden, then clicking the button hides them; and if they are hidden, then clicking the same button unhides them? I want to execute both procedures with one button.
Sub HideLLRows()
'This sub un/hides blank rows in EIRP LL
Application.ScreenUpdating = False
Dim LastRow As Long
Set EIRPLL = Sheets("EIRP LL")
LastRow = EIRPLL.UsedRange.Rows.Count
For i = 6 To LastRow
If EIRPLL.Range("B" & i) = "" Then
EIRPLL.Rows(i).Hidden = True
End If
Next
Application.ScreenUpdating = True
End Sub