Two macro button but in a double action
Hello
I am writing to ask for your assistance:
I did two macro to hide and display rows in my worksheet. I've done two buttons and everything works incredibly well, I turned the internet to find a solution how to get them into a button and perform the same actions. Ie it pressed once to perform (execute) the first macro, it rang a second time to perform the second macro.
Many ask for your assistance and thank you in advance
Code:
Sub hide()
Application.ScreenUpdating = False
Rows("2:2").Select
Selection.Locked = False
Selection.FormulaHidden = False
Range( _
"4:4,5:5,10:10,11:11,13:13,14:14,17:17,18:18,34:34,35:35,38:38,45:45,46:46,49:49,50:50,72:72,73:73,76:76,77:77,78:78,79:79" _
).Select
Range("A79").Activate
Selection.EntireRow.Hidden = True
Range("A3").Select
ActiveSheet.Protect ("kosta"), DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True
Application.ScreenUpdating = True
End Sub
-----------------------------------------------------------------------------------------
Sub unhide()
Application.ScreenUpdating = False
On Error GoTo ErrHandler
ActiveSheet.Unprotect Password:=InputBox("Please write your password!")
Cells.Select
Selection.EntireRow.Hidden = False
Range("A1").Select
Exit Sub
ErrHandler:
MsgBox "Wrong password", vbExclamation
'ActiveSheet.Unprotect ("kosta")
Application.ScreenUpdating = True
End Sub
And another thing I do not know how to do - what must complete and how and where it can be implemented both macro I select sheets (for example, the action is for sheet names - "Moscow", "London" , "Italy", "New Zealand", etc.) with just this one button?