Consulting

Results 1 to 7 of 7

Thread: Solved: Move to next cell

  1. #1
    VBAX Tutor Philcjr's Avatar
    Joined
    Jul 2005
    Location
    Bedminster, NJ
    Posts
    208
    Location

    Solved: Move to next cell

    All,

    Need some help, I have a spreadsheet that I need to collect numbers from the end user.

    I would like to move to the next cell once they have entered a number into the cell (and only a number).

    Example: (Cells that will have one number in each cell)
    F14, H14, J14, L14, N14, P14
    F16, H16, J16, L16, N16, P16
    F18, H18, J18, L18, N18, P18
    F20, H20, J20, L20, N20, P20

    Constraints:
    The user will only enter numbers into one row... either row 14, 16, 18 or 20 NEVER more than one row

    Is this a good time to use arrays?????

    Any help would be greatly apprecitated.

    Phil

  2. #2
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    Quote Originally Posted by Philcjr
    All,

    Need some help, I have a spreadsheet that I need to collect numbers from the end user.

    I would like to move to the next cell once they have entered a number into the cell (and only a number).

    Example: (Cells that will have one number in each cell)
    F14, H14, J14, L14, N14, P14
    F16, H16, J16, L16, N16, P16
    F18, H18, J18, L18, N18, P18
    F20, H20, J20, L20, N20, P20

    Constraints:
    The user will only enter numbers into one row... either row 14, 16, 18 or 20 NEVER more than one row

    Is this a good time to use arrays?????

    Any help would be greatly apprecitated.

    Phil
    Attached is an example spreadsheet that does most of what you want. If the user enters data in any of the above cells, the WorkSheet_Change function selects the next logical cell. If data is entered into the last cell in the row, the "next" cell is "F" (easy to change that).

    The procedure does not force data entry to a single row (that could be added), nor does it disallow entry into "other" cells (that could be added too), nor does it force data entry into the selected cell (that could be added).

    The target cells are green just to make things easier to see.

    Let me know if this is useful and if any additonal controls are necessary.
    "It's not just the due date that's important, it's also the do date" [MWE]

    When your problem has been resolved, mark the thread SOLVED by clicking on the Thread Tools dropdown menu at the top of the thread.

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    And for an alternative, here's a Userform solution.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Tutor Philcjr's Avatar
    Joined
    Jul 2005
    Location
    Bedminster, NJ
    Posts
    208
    Location
    MWE,

    PERFECT!!

    MDmackillop,

    Also perfect, however, the use of a user form in my speadsheet is not needed. But, THANK YOU anyway.


    One last question, as I am still wet behind the ears when it comes to VBA... is there a was to "nudge" the user to the next cell without them having to hit the "enter key"?

    Phil

  5. #5
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Phil,
    If you can live with coloured cells and a few navigation glitches (as you will see), this will move with the Enter key or right arrow.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  6. #6
    VBAX Tutor Philcjr's Avatar
    Joined
    Jul 2005
    Location
    Bedminster, NJ
    Posts
    208
    Location
    MDmackillop,

    Again, awesome!

    Thanks for all your help and time. I have presented the file to the end-users and they are happy

    Thank you!
    Phil

  7. #7
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Quote Originally Posted by Philcjr
    I have presented the file to the end-users and they are happy.
    I wonder what's wrong with the Enter key! .... but anything to keep the end users happy.

    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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