Hi, The following macro inserts a template from "room template" into "estimate" which is assigned to toolbar button. The problem I have is that if a user presses the button regardless of what sheet they have active the macro runs and unlocks the "active sheet" and then errors as it can't perform the rest of the function and everything is unlocked! What I would like to achieve is that : If the user is not on the "estimating sheet" then a message box appears stating "not allowed" with just a cancel button and the macro does not run.
ActiveSheet.Unprotect "password"
Sheets("Room Template").Visible = True
Sheets("Room Template").Select
Rows("1:18").Select
Selection.Copy
Sheets(" Estimate").Select
Application.EnableEvents = False
Selection.Insert Shift:=x1Down
Application.EnableEvents = True
ActiveSheet.Protect "password", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowInsertingRows:=True, AllowDeletingRows:=True
Sheets("Room Template").Visible = xlSheetVeryHidden
End Sub
Bookmarks