Closed Thread
Results 1 to 20 of 20

Cursor Movement

  1. #1
    Registered User
    Join Date
    05-03-2007
    Posts
    26

    Cursor Movement

    Dear Experts.

    In sheet1, The cursom must move only following cells

    A2,A5, C10 C15, D15, E50

    Besides this the cursor should not move to any cell.
    It must remain between the cells that I described above.

    Please help

  2. #2
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    Hi,

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,854
    Without using VBA, you could also just use sheet protection.

    1. Select the 6 cells you mentioned
    2. Right-click and choose Format Cells..
    3. Select the Protection Tab and uncheck the 'Locked' flag
    4. Select Tools -> Protection -> Protect Sheet
    5. On the Protect Sheet dialog window, uncheck 'Select locked cells', leaving 'Select Unlocked Cells' as the only checked option
    6. Set a password (if you want, it's optional) and click OK

  4. #4
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    Not sure how reliable this is but you could try it for a while:

    Please Login or Register  to view this content.
    Last edited by Reafidy; 05-11-2007 at 12:12 AM.

  5. #5
    Registered User
    Join Date
    05-03-2007
    Posts
    26
    Dear Sir,

    Your codes do not work.
    Please review attachement

    thanks
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    I would use Paul suggestion above if possible.

    What is the problem with the code? - I opened your attachment and moved the cursor between the cells seemed to work ok.


    Can anybody else test?

  7. #7
    Forum Contributor
    Join Date
    08-28-2006
    Posts
    280

    I tried it.

    Readify,

    It starts to move out of cell A2, but jumps right back. Sort of a flicker-then nothing.

    See ya,

    Dean

  8. #8
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    Really, well thats strange it works fine for me. Im confused.

  9. #9
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Reafidy

    It works ok for me

    I think what is confusing them is that when they try and select any cell that is not on the allowed list, the activecell reverts back to the last cell that was allowed to be active. This is A2 when you 1st open the book.

    Maybe what they want is that if the next cell in the list to become active & not revert back to the last activecell
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  10. #10
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    Thanks mudraker,

    Thought I was losin it. Maybe something like this.

    Please Login or Register  to view this content.

  11. #11
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Reafidy

    I see you have already replied while I was creating this code so I thought I would post it anyway

    Seems to do the same as yours

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    It does the same and its better

    That will teach me for being lazy.

  13. #13
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Here is another version that is much easier to adapt when cell need to be removed or additional ones added.

    I wrote this after a similar question was asked in another thread

    http://www.excelforum.com/showthread.php?t=599708


    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    Mudraker,

    Thats a nice peice of code, however it seems to be selecting three cells at once?

  15. #15
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    I had 1 command in the wrong location

    Please Login or Register  to view this content.

  16. #16
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Everbody,

    Here is a piece of code I modified to handle ranges with multiple cells in the selection. It Copies all the cell addresses into an array. Add the cell ranges you want to tab through on the sheet in the macro code in Red.

    Installing the Macro:
    1) Copy the Macro code using CTRL+C
    2) Right Click on the Worksheet Tab of Worksheet which will Tab
    3) Click "View Code..." on the Popup menu
    4) Paste the code using CTRL+V
    5) Press CTRL+S to save the macro

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  17. #17
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    Nice work both of you, I was going to have a go at an array version but I wont bother now Leith has covered it nicely.
    Good work chaps.

  18. #18
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Leith

    Nice code.

    I knew their was a way of doing it using arrays, but do you think I could get my brain to come up with a working method last night - no I could not.

  19. #19
    Registered User
    Join Date
    05-03-2007
    Posts
    26
    Dear All
    Please Login or Register  to view this content.
    In above example, I refer to

    Case "$A$5"
    Range("c10").Select

    Suppose the cusor is in cell A5, here when I press enter then coursor moves to C10

    Is it possible to move move cursor in cell A2 by pressing UPARROW KEY like excel general sheet.

    In other words,cursor should easily move in given cells with arrow keys.

    Please help

  20. #20
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Here is one way

    Place this macro on the ThisWorkbook module. Change sheet1 as required

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    A macro could be made so that the onkey command only works whilst the required sheet is active.
    Last edited by mudraker; 05-19-2007 at 01:09 AM.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1