View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Changing the value of a protected cell

Assuming you don't want to unlock the cell before you protect the sheet, then

Sub go()
Dim goal As Range
Set goal = Sheets("sheet1").Range("A1")
ActiveSheet.Unprotect Password:="ABC"
Range("A1") = goal + 1
Activesheet.Protect Password:="ABC"
End Sub

--
Regards,
Tom Ogilvy



"Shawn" wrote:


Sub go()
Dim goal As Range
Set goal = Sheets("sheet1").Range("A1")

Range("A1") = goal + 1
End Sub

I get an error because this is on a protected sheet and protected cell. How
can I get result without having to unprotect the sheet?


--
Thanks
Shawn