Hello all
I have a VBA macro assigned to buttons to hide and unhide rows. However, if I insert or delete rows anywhere on the worksheet, the row references remain the same, which means the macro hides the wrong rows. Is there a way to amend the macro so that if I insert a row, it updates the row range to 68:170 for example? Many thanks in advance.
Sub unHide_Rows_org()
'To unHide Rows 67 to 169
Rows("67:169").EntireRow.Hidden = False
End Sub
Sub Hide_Rows_org()
'To Hide Rows 67 to 169
Rows("67:169").EntireRow.Hidden = True
End Sub
I have a VBA macro assigned to buttons to hide and unhide rows. However, if I insert or delete rows anywhere on the worksheet, the row references remain the same, which means the macro hides the wrong rows. Is there a way to amend the macro so that if I insert a row, it updates the row range to 68:170 for example? Many thanks in advance.
Sub unHide_Rows_org()
'To unHide Rows 67 to 169
Rows("67:169").EntireRow.Hidden = False
End Sub
Sub Hide_Rows_org()
'To Hide Rows 67 to 169
Rows("67:169").EntireRow.Hidden = True
End Sub