Anonymous321
New Member
- Joined
- Oct 12, 2021
- Messages
- 32
- Office Version
- 365
- Platform
- Windows
Hi, I'm wondering if it's possible to set up a macro that hides a certain row if all rows within a given range are hidden.
For example, if rows 5 to 9 are hidden then hide row 4. I made a code that works on a single row but I want it to work for multiple rows. My problem at the moment is that if row 5 is empty, for example, row 4 will be hidden regardless to whether or not the other rows in the range are not hidden,
This is the code I'm currently using.
If Range("6:10").EntireRow.Hidden Then
Range("5:5").EntireRow.Hidden = True
End If
Any help will be appreciated
For example, if rows 5 to 9 are hidden then hide row 4. I made a code that works on a single row but I want it to work for multiple rows. My problem at the moment is that if row 5 is empty, for example, row 4 will be hidden regardless to whether or not the other rows in the range are not hidden,
This is the code I'm currently using.
If Range("6:10").EntireRow.Hidden Then
Range("5:5").EntireRow.Hidden = True
End If
Any help will be appreciated