View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Protecting certain cells

Hi William,

You can just unprotect and protect the sheet within your macro, e.g.:

Sub Test()
Pass="YourPassword"
Worksheets("Sheet1").Unprotect Pass
'your code here
Worksheets("Sheet1").Protect Pass
End Sub

Regards,
KL


"William Spence" wrote in message
ups.com...
I am writing a program where i need to clear, and color certain cells,
but want the user to have read only access on this particular page.
When i all the cells i want locked and I protect the sheet, my program
keeps getting stopped on the lines of code that clears, and colors
these cells. How would i keep these cells protected but still be able
to clear and color them.