View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
derrida derider[_2_] derrida derider[_2_] is offline
external usenet poster
 
Posts: 2
Default Not allow user to select a locked cell

Try:
ActiveSheet.EnableSelection = xlUnlockedCells

Of course ActiveSheet can be replaced with Sheets("whatever") if you want to
specify it for a specific worksheet.

"CoolCyber" wrote:

Hi,

How can i not allow user to select a locked cell? I want to do it using VBA.
I can do it in gui, by unselecting the "allow select locked cells" in
protection. But when i close and open that option is checked again. so i
want to do it in the code. as i am unprotecting and protecting the sheet in
it.
I do it as
sheet2.unprotect("password")
sheet2.protect("password")

after this is done, the user can select the cell but he can't modify it. any
help is appreciated.

thanks