+ Reply to Thread
Results 1 to 19 of 19

VBA Msgbox

  1. #1
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    VBA Msgbox

    Hey Everyone,

    I'm trying to have a Message Box pop up under certain conditions. I've done some research and done some coding in VBA, but being a newbie, i'm having troubles. It's really trial and error for me.

    Based on the attached sample file:

    A message will appear with "text" when..... E4, E6, E8... etc = (text within a list on a seperate sheet) & Q4, Q6, Q8...etc = "Jeta1"

    The list is actually called "Additive" under the tab/sheet "Lists"

    Any help would be greatly appreciated. Thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Msgbox

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: VBA Msgbox

    Whoa, thats intense! A little out of my league. I'm trying to make sense of it, but it looks like it's not working when I put it into VBA. ?

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Msgbox

    Hmm, it worked just fine for me on your sample workbook. Did you enable macros? Did you put it in the right section of the visual basic editor? Did you meet the correct parameters (a value in column E4, E6, etc.... and "JetA1" in column Q)?

    Also, if you need an explanation on what in going on in the code let me know.
    Last edited by stnkynts; 09-25-2013 at 01:06 PM.

  5. #5
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: VBA Msgbox

    Hey Stnkynts,

    An explanation would be awesome!

    I'm using the exact same sample file to understand.

    I copied the code from above and put it into the VBA. I then hit play button (Run Sub/ Userform). When I do this, I get the MsgBox. But when i fill in E4 & Q4, nothing happens.

  6. #6
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Msgbox

    Here is a screenshot of it working for me.

    test123.gif

    Here is a description of what the code is doing:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: VBA Msgbox

    Hey Again,

    Thanks for the explanation

    It works, but only when I select the "Run Sub/ Userform" in the VBA.... Is this correct? I'm looking for when the cells are populated, the message will come up.

    And just to confirm, i did save it as a Macro Enabled file (.xslm)
    Last edited by Eaks77; 09-26-2013 at 05:20 PM.

  8. #8
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Msgbox

    Quote Originally Posted by Eaks77 View Post
    I'm looking for when the cells are populated, the message will come up.
    Ahh i see. You need a worksheet change event. Do you want it to run the check after you put data in column E or column Q? or Both?

  9. #9
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: VBA Msgbox

    Hmmm... I think it'll be best when both are populated

  10. #10
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Msgbox

    Ok try this. It is my understanding that you want to check the row that you are entering data in at that time and only that row. I wasn't sure what you wanted the message to be, but you should be able to see how to change it.

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: VBA Msgbox

    Hey Again,

    I tried this code and it's not working. :s I've ensured that macros are enabled... But when entering data, no message appears. What am I doing wrong?

    Thanks

  12. #12
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Msgbox

    Did you put it in the correct spot? Go to the visual basic editor, on the left side find the "Initial" sheet, double click it, paste the code in.

  13. #13
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: VBA Msgbox

    Hey,

    Yup, its in the correct spot. :s not sure what i'm doing wrong. Could you send the file you have?

  14. #14
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Msgbox

    sample.xlsm

    Instructions are on the first sheet.

  15. #15
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: VBA Msgbox

    Hey Again,

    At first... it wasn't working. But I figured out why... the hint was all in your message . You said type in WEL into E4 and then "SELECT" jeta1.... however we rarely "SELECT" from the drop down. Most of the time we type in "Jeta1" and rarely select. I think this is where the problem is. If I select from the drop down, no problem! If i type it, it doesnt work. :s Is there a way to make both scenarios work? Thanks!

  16. #16
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Msgbox

    Both scenarios do work. You just didn't pay attention to the capitalization. JetA1 is not the same as Jeta1. If you want to use Jeta1 then change the code. If you want to be able to do both (capital and lowercase) that too is possible but requires a bit of extra work on the code. Another option would be to change the code and your list drop down values.
    Last edited by stnkynts; 10-02-2013 at 10:29 AM.

  17. #17
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: VBA Msgbox

    Ahhh didn't know it was that specific about capital letters. Unfortunately i'll need it to work for "Jeta1" "JetA1" "jeta1" and "jetA1" Is there no way to set it up so that it doesnt matter what is capitlized? Thanks again for all your help!

  18. #18
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: VBA Msgbox

    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    09-17-2013
    Location
    Edmonton
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: VBA Msgbox

    This is perfect!!!! Thank you very much for you help and patience Stnkynts! It's been an education!

+ 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] Problem with VBA Editor uses lower case on some lines (ex. msgbox instead of MsgBox)
    By stubbsj in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-14-2013, 06:59 PM
  2. [SOLVED] MsgBox if Yes do something, if No do something else
    By john55 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-08-2012, 12:50 PM
  3. MsgBox-center the message on a msgbox
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-11-2007, 06:48 AM
  4. [SOLVED] MsgBox-at the end a msgBox popup
    By CC in forum Excel General
    Replies: 4
    Last Post: 05-05-2006, 12:50 PM
  5. MsgBox Help
    By Zach H in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-24-2006, 11:16 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