I am trying to create a macro what will hide the rows that are blank when the column I11:I28 is blank. I have a macro started that will hide the cells when the button is selected but if I select the button again I want the hidden cells to be unhidden.
Below is the macro that I am currently using just need to add the unhide function when the macro button is selected.
Any help would be greatly appreciated
Sub Hide_me()
Dim MyRange, MyRange1 As Range
LastRow = Cells(Rows.Count, "I").End(xlUp).Row
Set MyRange = Range("I11:I28")
For Each c In MyRange
If IsEmpty(c) Then
If MyRange1 Is Nothing Then
Set MyRange1 = c.EntireRow
Else
Set MyRange1 = Union(MyRange1, c.EntireRow)
End If
End If
Next
If Not MyRange1 Is Nothing Then
MyRange1.EntireRow.Hidden = True
End If
End Sub
Bookmarks