R
ravilal123
I am using the following code as master code to hide unhide rows in a spreadsheet. This code conststs of several ranges. I am also using similar code to hide unhide indiviual range.
This code works fine if all the ranges are either hidden or unhidden. However, if one range is unhidden, and remaining hidden then the codes firsts hides open rows then unhides the remaining rows and viseversa.
I want all the rows to open or close when I run the code regardless of its position (open/close) at the time of running the code.
Note - I have created a button on the sheet to activate this code.
Sub Hide_Unhide6()
For Each cell In Range("A7:A15,A17:A60,A62:A92,A94:A111,A113:A113")
If cell.EntireRow.Hidden = False Then
cell.EntireRow.Hidden = True
Else
cell.EntireRow.Hidden = False
End If
Next
End Sub
This code works fine if all the ranges are either hidden or unhidden. However, if one range is unhidden, and remaining hidden then the codes firsts hides open rows then unhides the remaining rows and viseversa.
I want all the rows to open or close when I run the code regardless of its position (open/close) at the time of running the code.
Note - I have created a button on the sheet to activate this code.
Sub Hide_Unhide6()
For Each cell In Range("A7:A15,A17:A60,A62:A92,A94:A111,A113:A113")
If cell.EntireRow.Hidden = False Then
cell.EntireRow.Hidden = True
Else
cell.EntireRow.Hidden = False
End If
Next
End Sub