Reputation: 19
As the title suggests, I am looking for a way to hide a row if the above row is blank, otherwise un-hide that row. It seems that it should be simple but I can't seem to do it.
After research I did come across this code that looks to me it should work, however I am not getting any response out of it.
Range("A15:A21").AutoFilter 1, "<>", , , False
The range is correct in the above code.
Upvotes: 0
Views: 311
Reputation: 81
I believe this macro should do the trick
Sub hide_if_blank_above()
Dim i As Integer
For i = 21 To 15 Step -1
Dim should_hide As Boolean
should_hide = IsEmpty(Range("A" & i - 1))
Range("A" & i).EntireRow.Hidden = should_hide
Next
End Sub
Upvotes: 1