+ Reply to Thread
Results 1 to 8 of 8

Offset VBA - Cursor Navigation

  1. #1
    Registered User
    Join Date
    08-21-2012
    Location
    Heckmondwike, England
    MS-Off Ver
    Excel 2007, 2010, 2013
    Posts
    54

    Offset VBA - Cursor Navigation

    Quick question,

    I have produced a very simple macro which basically just clicks the left arrow key once to the left, I believe this is correct

    ActiveCell.Offset(0, -1).Select

    My problem is the above line of code ignores the cell protection, I have protected the page and left only the cells I want the user to click in unlocked.

    Can anyone advise how I could modify the above code to add this ability in?

    Thanks in advance.

    Darren

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Offset VBA - Cursor Navigation

    try this macro:
    Please Login or Register  to view this content.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    08-21-2012
    Location
    Heckmondwike, England
    MS-Off Ver
    Excel 2007, 2010, 2013
    Posts
    54

    Re: Offset VBA - Cursor Navigation

    Hi Pierre, unfortunately didnt work, hmm.

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Offset VBA - Cursor Navigation

    look at attached file. It sure works on my computer though.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-21-2012
    Location
    Heckmondwike, England
    MS-Off Ver
    Excel 2007, 2010, 2013
    Posts
    54

    Re: Offset VBA - Cursor Navigation

    Hi Pierre,

    Thanks for that, I can see the issue now,

    What I did on my file was something similar to the following on your file:

    B27, when macro is run I would need the cursor to move to I26.

    I can see how that would complicate things, any workaround?

    Darren

  6. #6
    Registered User
    Join Date
    08-21-2012
    Location
    Heckmondwike, England
    MS-Off Ver
    Excel 2007, 2010, 2013
    Posts
    54

    Re: Offset VBA - Cursor Navigation

    Thinking about it, I could simply use a 2nd macro going to the right in that situation.

    Any chance you could modify your original code to move to the right please?

    I think this would be the simplest option

    Darren

  7. #7
    Registered User
    Join Date
    08-21-2012
    Location
    Heckmondwike, England
    MS-Off Ver
    Excel 2007, 2010, 2013
    Posts
    54

    Re: Offset VBA - Cursor Navigation

    Hi Pierre,

    After relooking at the file I am working on I would have to go up 1 row and then across 1 to the right.

    If you can modify your original code for this I would be very grateful, if not thats ok mate.

    I have already given you rep

    Thanks again
    Darren

  8. #8
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Offset VBA - Cursor Navigation

    this macro will move the activecell to the right
    Please Login or Register  to view this content.

+ Reply to 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