+ Reply to Thread
Results 1 to 18 of 18

Message Box Range

  1. #1
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Message Box Range

    Hello all,
    Can you please add something in the code?
    After the message box appear and when I click "OK" then it will go directly to AI5.

    Thanks in advance :o)

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Message Box Range

    How about...

    Please Login or Register  to view this content.
    HTH
    Regards, Jeff

  3. #3
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Re: Message Box Range

    Hi Jeffrey,
    I did put the code but when I click "OK" after the message box it went to the AI5 and it pass it.

    Thanks.

  4. #4
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Re: Message Box Range

    Oh... I just notice that if I use the mouse to click "OK" then it does goes in the AI5 but I if I use the "enter" key then it pass it.

    Can you please fix it so I am able to use the enter key as well.

    Thank you

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Message Box Range

    Whether I use the Ok button or hit enter, the cursor still goes to AI5.

    Could something you are doing from your other thread getting in the way?

    Remove some of the other code and then try. Again, it works for me by going directly to AI5 when hitting enter.

  6. #6
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Re: Message Box Range

    Hi
    I removed the
    Target,Select
    In the code and it works.

    Is it possible to have the cells be in order when I press the enter key after the entry in AI5.
    Let say AI5, then when i press enter it woll go to H10, J15
    And N20.

    Something like this

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Message Box Range

    I have not idea what this means. What do you mean when you press the enter key.

    The code only triggers off of cell J4. Are you saying as you change the value in J4 again you want another cell selected?

    Based on what? A value already in AI5?

    Remember, this is your project so you have to do a little more explaining so we can understand.

  8. #8
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Re: Message Box Range

    Hi Sorry,
    I will try.

    Since the cursor is in AI5, after J4...
    After I enter the date in AI5 i want my next entry to go to H10 then next to J15, etc. by pressing the enter key.

    Thanks

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Message Box Range

    Sorry. Not sure how to approach this.

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Message Box Range

    Is this what you mean
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Re: Message Box Range

    Hi Fluff13
    This is exactly what I was looking for. Question, so this code does only for the Enter Key. Can it be done both for Enter and Tab key?
    So when the user use press either enter/tab key will work same. As of now, when I tried using the enter key, it works as I wish for but when I try to use the tab key, it does not do the same as the enter key.

    Thanks :o)

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Message Box Range

    As long as you have entered the cell (F2 or doubleclick) the code will fire regardless of how you leave the cell.

  13. #13
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Re: Message Box Range

    Hi
    Ok... Here is my issue. I attached the file.
    If I use the tab key and I click "OK" it does what it supposed to do according to the code. No problem using the tab key.

    Now the issue here is the Enter key.
    Try to enter 1234 at the Item # box and press enter or click "OK" and you will see that the Received box will automatically check and the cursor stopped at N10. The cursor should go to next cell (AI5) when you click "OK" and no check box should be mark. And, it should goes to next cell according to the VBA code.

    Also, according to the last code (see below) that my last cell is Q44 and it should return to the J4 not AI5.

    Please Login or Register  to view this content.
    Please fix.

    Thank in advance.
    Attached Files Attached Files
    Last edited by RJ1969; 04-20-2019 at 10:12 PM.

  14. #14
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Message Box Range

    With all those different event codes it's difficult to figure out what's going on.
    Why you get different behaviour depending on whether you Tab or Enter I'm not sure.

  15. #15
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Message Box Range

    The problem is when you "tab" the next available cell will be selected.
    When you "Enter", the selection will be the next available cell down.

    When you hit enter, L10 becomes the target cell. Selecting AI5 is too late,
    the code still has to process L10 in the selection_change events.

    One idea I have would be to check if the previous target address was J4 and
    the current target address is L10, if they equal, then select AI5 and exit the selection_change event.
    .
    .
    Get targetaddress.jpg

    Check it the target ranges match
    .
    TargetAddress.jpg

    .
    Please Login or Register  to view this content.
    Last edited by davesexcel; 04-21-2019 at 10:38 AM.

  16. #16
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,719

    Re: Message Box Range

    Hi davesexcel,
    I tried. Still doesn't accomplish what I really wish to do in the worksheet.

    Here is the scenario.
    Type something in the item box "1234" press the tab key (msg box) will come up, then the cursor will stop in AI5 and now just keep tabbing the key and you will notice that the cursor is going in order as you tab it.
    Did you see how the cursor goes from J4 to AI5 to R38 to U41 to Q44 then it return back to the beginning J4.
    This is exactly what I want to do with the enter key. If you try the scenario using the enter key then you notice the differences between the tab key and the enter key.

    Thanks.

  17. #17
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Message Box Range

    You have added VBA that controls where you "Tab" to, that would be why it is not selecting the other unlocked cells as you tab along.

  18. #18
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Message Box Range

    Administrative Note:

    Welcome to the forum.

    We would love to help you with your query; however, it has been brought to our attention the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    http://www.vbaexpress.com/forum/show...045-ICOLOR-TAB

    Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Message box when in range....
    By dekueb in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-28-2015, 02:56 PM
  2. [SOLVED] Select range and put in message box
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-13-2014, 04:59 PM
  3. Replies: 0
    Last Post: 07-31-2013, 06:03 AM
  4. [SOLVED] Search Range for NAs and pop up with a message box
    By morbdetro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2013, 02:49 PM
  5. Message Box for range of cells
    By Ryusui in forum Excel General
    Replies: 12
    Last Post: 10-20-2009, 06:03 PM
  6. out of range error message
    By juergenkemeter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2006, 02:10 AM
  7. If with a range:message news:
    By Bernie Deitrick in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 04:05 AM

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