View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
George Clark George Clark is offline
external usenet poster
 
Posts: 3
Default control advancing to cells

It's certainly possible to control where the cursor goes each time, but it
can get a bit complicated, depending on the setup in the worksheet. Perhaps
simply preventing the cursor from going to protected cells would suffice.

To do that, in the Workbook_Open event you could put something like:

Private Sub Workbook_Open()
Worksheets("Sheet1").EnableSelection = xlUnlockedCells
End Sub

Replace "Sheet1", of course, with whatever the name of the worksheet is. You
can do the same for multiple sheets if necessary.

As long as the sheet is protected, the cursor can only go to cells that are
marked as "unlocked."

As with any programming solution, the user must enable macros when they open
the workbook for this to work. Unfortunately, even though you can set the
Worksheet.EnableSelection property in the VBE, it doesn't "stick", so must
be set each time the workbook is opened.

George

On 6/23/04 00:12, Junior did expound most eloquently:

My spreadsheet has protected and unprotected cells
i thought that when the sheet is protected -
it would advance to the next unprotected cell when return is pressed
but not so on this one-
how can i program which cell it will advance to next?



--
Mac Word FAQ: <http://www.mvps.org/word/FAQs/WordMac/index.html
Entourage Help Page: <http://www.entourage.mvps.org/
Or try Google: <http://www.google.com

Please do not reply to this message. Although the email address is perfectly
valid, any replies to this account never get to the Inbox on my computer.