Excel Pooh
New Member
- Joined
- Jul 20, 2021
- Messages
- 7
- Office Version
- 365
- Platform
- Windows
Good afternoon world of smarter people than I. I am trying to create a macro that first unhides all rows on a worksheet, then checks all rows to see if there is content in Column E and/or Column H. If they are BOTH blank, I would like those entire rows to then be automatically hidden. I have Frankenstein-ed together an attempt from searching here and other forums and it has gotten me close, but still leaves some random rows visible when they have no content. Could anyone please let me know where I've gone wrong or even show me something fresh that is better? I appreciate your time, code is below.
Sub HideRows()
Application.ScreenUpdating = False
Application.Calculation = xlManual
Rows("3:700").Hidden = False
For Each c In Range("E3:E700")
If c.Value = "" And c.Offset(3).Value = "" Then Rows(c.Row).Hidden = True
Next c
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
Sub HideRows()
Application.ScreenUpdating = False
Application.Calculation = xlManual
Rows("3:700").Hidden = False
For Each c In Range("E3:E700")
If c.Value = "" And c.Offset(3).Value = "" Then Rows(c.Row).Hidden = True
Next c
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub