I am attempting to use one macro to unhide a select group of rows in a locked worksheet. I have a VBA code but it only unhides 1 row at a time, and the one who wrote it isn't around to fix it.
I am looking to make 1 button that when clicked, will unhide rows 110:130, then if pressed again will unhide rows 131:154 and so on.
This is the code I have been using:
Sub UnhideRows110_130()
Sheet1.Unprotect Password:="pass"
If Rows("130").Hidden = False Then MsgBox "No more rows available": Exit Sub
For ThsRw = 110 To 130
If Rows(ThsRw).Hidden = True Then
Rows(ThsRw).Hidden = False
Exit For
End If
Next ThsRw
Sheet1.Protect Password:="pass"
End Sub
Sub UnhideRows131_154()
Sheet1.Unprotect Password:="pass"
If Rows("153").Hidden = False Then MsgBox "No more rows available": Exit Sub
For ThsRw = 131 To 154
If Rows(ThsRw).Hidden = True Then
Rows(ThsRw).Hidden = False
Exit For
End If
Next ThsRw
Sheet1.Protect Password:="pass"
End Sub
I am looking to make 1 button that when clicked, will unhide rows 110:130, then if pressed again will unhide rows 131:154 and so on.
This is the code I have been using:
Sub UnhideRows110_130()
Sheet1.Unprotect Password:="pass"
If Rows("130").Hidden = False Then MsgBox "No more rows available": Exit Sub
For ThsRw = 110 To 130
If Rows(ThsRw).Hidden = True Then
Rows(ThsRw).Hidden = False
Exit For
End If
Next ThsRw
Sheet1.Protect Password:="pass"
End Sub
Sub UnhideRows131_154()
Sheet1.Unprotect Password:="pass"
If Rows("153").Hidden = False Then MsgBox "No more rows available": Exit Sub
For ThsRw = 131 To 154
If Rows(ThsRw).Hidden = True Then
Rows(ThsRw).Hidden = False
Exit For
End If
Next ThsRw
Sheet1.Protect Password:="pass"
End Sub