I want to make locked cells un-clickable

  • Thread starter Thread starter John
  • Start date Start date
J

John

What is the VBA command to do this? I want to be able to just tab over
to unlocked cells and skip locked cells completely.

I knew how to do this once, but I must have learned something new
which crowded out that bit of knowledge. Thanks for your help.

-John L.
 
John, here is one way, put in thisworkbook code

Private Sub Workbook_Open()
'will not let you select locked cells
'This is a setting that Excel doesn't remember between closings,
'that is why it in the workbook open event

'change to your sheet name
With Worksheets("sheet1")
.Activate
.EnableSelection = xlUnlockedCells
.Protect Contents:=True, UserInterfaceOnly:=True
End With
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
** remove news from my email address to reply by email **
 
I tried this code in my Workbook_Open Object, but when I saved and
reopened, it asked for my password. I hit cancel (since I don't want the
user to have to enter a password) and then clicked my macro button. I
then got an error 1004 which is what I get when the sheet is protected and
I try to run a macro. I want to protect a group of cells on the sheet and
still be able to run a macro on them. I seem to be able to get many
things to do this for me until I save and close the file. Then all bets
are off!! Please help if you can.

Thanks
 

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