Hey all,
I recorded a simple macro and linked it to a button that hides rows 10-15 in a worksheet. There is another button that unhides the same rows. What do I need to add to the code to stop it from breaking when I insert or delete rows before 10-15?
Do I have to name that range and then look up that named range? If so, how do I do that?
I have attached an example for reference, and copied the code below.
Cheers,
B
This is the code:
Sub HideCells()
'
' HideCells Macro
'
'
Rows("10:15").Select
Selection.EntireRow.Hidden = True
End Sub
Sub UnhideCells()
'
' UnhideCells Macro
'
'
Rows("9:16").Select
Selection.EntireRow.Hidden = False
Range("B9").Select
End Sub
Bookmarks