Control Cursor Movement

  • Hello All,


    I am a novice and I am developing an invoice templet and would like to define the specific movement for the cursor from cell to cell. I searched the forum and found the following in another thread:


    Quote

    This routine should do what you want. You should set your options/preferences to " move selection after enter".
    VB: AutoLinked keywords will cause extra spaces before keywords. Extra spacing is NOT transferred when copy/pasting, but IS if the keyword uses "quotes".


    I have questions.


    First, are the entries in the Array {"$A$1", "$F$5", "$B$12", "$A$6"} the cell IDs?


    If yes, is there a limit to the number that you can enter into the array?


    Also, can the cell IDs be split between lines as long as they are still enclosed with ()s for readability?


    Finally, where do I put this code, in the workbook or in a module?


    Thanks in advance for any and all help,


    Rhonda

  • Re: Defined Cursor Movement


    Quote from Rhonda

    First, are the entries in the Array {"$A$1", "$F$5", "$B$12", "$A$6"} the cell IDs?

    Yes (adresses actually, and they don't need to be absolute, so "A1" would do instead of "$A$2")

    Quote from Rhonda

    If yes, is there a limit to the number that you can enter into the array?

    I'm not sure!

    Quote from Rhonda

    can the cell IDs be split between lines as long as they are still enclosed with ()s for readability?

    Yes, with the continuation characters (space and underline) thus:

    Code
    Addresses_InOrder = Array( _
    "$A$1", _
    "$F$5", _
    "$B$12", _
    "$A$6")


    Quote from Rhonda

    where do I put this code, in the workbook or in a module?

    in a module, specifically the one for the worksheet you're wanting it to work on, which you can gain access to with a right click on the sheet tab and choosing 'View code' from the menu which pops up.
    Though it may be easier to just select the cells you want the person to edit while holding down the control key, then under Format|Cells, choose the Protection tab and uncheck the Locked checkbox, OK. Then protect the worksheet by Tools|Protection|Protect Sheet and uncheck the Select Locked Cells checkbox while still allowing them to select unlocked cells, OK.
    This, though, is perhaps not exactly what you want to do.
    p45cal

  • Re: Defined Cursor Movement


    Thanks p45cal!!


    Your answers helped and now that part is working. Is there a way to cause the cursor to move in the reverse direction when the shift-tab is pressed? That is, if you have gome 1 or 2 cells beyond where you want to go, can you go backward with the shift-tab?


    Rhonda

  • Re: Control Cursor Movement


    Not without significant change to the code you supplied. Yes if you've used my suggestion of an alternative way (on the last couple of lines of my last post) - it happens automatically, only you have less overall control over which is the next cell to be selected.
    p45cal

  • Re: Control Cursor Movement


    OK, I still need to be able to go back with the shift-tab.


    If the code needs to be changed could you help me do this...Here is the code as it is now


    Also, how do I anchor the starting cell so that when you open the templet, the starting cell is the same everytime. Right now the startup is the last tab to cell.


    Thank you!!


    Rhonda

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!