Macro to Unprotect save worksheet and protect it again.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a macro to unprotect cells B6:O6 and protect them back.
I would appreciate your help .

Thank Ken Calhoun
 
Activesheet.Unprotect Password:="ABC"
Range("B6:O6").Locked = False
Activesheet.Protect Password:="ABC"





Activesheet.Unprotect Password:="ABC"
Range("B6:O6").Locked = True
Activesheet.Protect Password:="ABC"
 
This should do exactly as you asked!

Regards,
Simon

Sub Test()
ActiveSheet.Unprotect
Range("B6:O6").Select
Selection.Locked = False
Selection.FormulaHidden = False

'WHATEVER YOU WANT TO DO WITH THE CELLS HERE

Range("B6:O6").Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True
Scenarios:=True
ActiveWorkbook.Save
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top