Lock the cells and protect the worksheet. Have the macro unprotect the sheet
and then reprotect it when done.
ActiveSheet.Unprotect Password:="mypassword"
'Do Stuff
ActiveSheet.Protect Password:="mypassword"
There are a lot of potential options for protection so I would recommend
that you use the marco recorder to record you sheet protection to get all of
the conditions.
NOTE: The recorder will not record the password, you need to add this
section manually
This is a sample of what you may get
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
True, AllowFormattingCells:=True, AllowFormattingColumns:=True,
AllowFormattingRows:=True
Simply add the condition Password:="mypassword" like this
ActiveSheet.Protect Password:="mypassword",DrawingObjects:=False,
Contents:=True, Scenarios:= _
True, AllowFormattingCells:=True, AllowFormattingColumns:=True,
AllowFormattingRows:=True