+ Reply to Thread
Results 1 to 8 of 8

VBA MsgBox pop up required based on two criteria.

  1. #1
    Forum Contributor
    Join Date
    03-09-2012
    Location
    Isle of Man
    MS-Off Ver
    Excel 2010
    Posts
    118

    VBA MsgBox pop up required based on two criteria.

    Hi Folks,

    I currently have a MsgBox that appears when cells in column T contains the word "Switch". If it does then the MsgBox prompts the user to make some manual changes.



    Please Login or Register  to view this content.
    I need this manual step as the user needs to insert cash figures in column D.

    This morning the user ignored the prompt and clicked yes when they should have clicked no.

    If they click yes the macro continues along it merry way doing all sorts of calculations.

    I am looking for some code that, if the user clicked yes the macro would continue (as it usually does) but the first task after clicking on "Yes" would be to look at column T for the word "Purchase" and if corresponding cell in column G contains the word "REDS" then bring up another MsgBox reprimanding the user for not changing the cell in column G from "REDS" to "SUBS". When they click OK it would Exit Sub. They would then make changes and run the macro again. Hopefully with everything corrected this time allowing the full macro to finish.

    I appreciate there could be some functionality to make sure that if column T contain the word "Purchase" that the corresponding cell in column G could be changed to "SUBS" automatically but things aren't quite as straightforward as I have laid out above.

    Sorry if the above is not clear and thanks as always for any help.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: VBA MsgBox pop up required based on two criteria.

    If
    things aren't quite as straightforward as I have laid out above
    it might be easier to help if you posted a copy of your file with a detailed explanation of what you want to do using a few examples and referring to specific cells. This would probably save a lot of time.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Contributor
    Join Date
    03-09-2012
    Location
    Isle of Man
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: VBA MsgBox pop up required based on two criteria.

    I think maybe I'm giving information overload.

    I basically need a MsgBox to pop up based on the contents of two columns rather than one. I can currently search a column to check for a word which brings up the message.

    I need the code to look at one column for a word (in this case "Purchase") and check the cell in a corresponding column for another word (In this case "REDS") if both the criteria are met then a MsgBox pops up. So if it checked column A and found the word "Purchase" in cell A12 then it would look to see of B12 contained the word "REDS". If B12 did contain the word "REDS" then a MsgBox pops up, otherwise the macro would continue.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: VBA MsgBox pop up required based on two criteria.

    OK. I think I understand what you are trying to do but it sounds that what you are asking for in Post#3 would only be a smaller part of a larger macro. I can give you that part of the code if you wish but sometimes inserting it into another macro can cause problems. I would be willing to work on a suggestion for the whole macro that would cover everything you want to do based on your original post, but it would be easier to do that if I could work with your actual file so I would need you to post a copy. If it contains confidential information, you could replace that with generic data. Please let me know how you want to proceed.

  5. #5
    Forum Contributor
    Join Date
    03-09-2012
    Location
    Isle of Man
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: VBA MsgBox pop up required based on two criteria.

    Thanks Mumps1,

    The VBA code for the whole macro is about 75 pages long if pasted into a word document and would contain a lot of confidential data.

    I do acknowledge your concerns regarding pasting into an existing macro but I would be testing it first and keeping a back up of my existing macro.

    If you were able to come up with some code I would be grateful.

    Thanks

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: VBA MsgBox pop up required based on two criteria.

    See if this helps:
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    03-09-2012
    Location
    Isle of Man
    MS-Off Ver
    Excel 2010
    Posts
    118

    Re: VBA MsgBox pop up required based on two criteria.

    Thanks Mumps1,

    That worked an absolute treat.

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,027

    Re: VBA MsgBox pop up required based on two criteria.

    My pleasure.

+ 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] Required data field; MsgBox does not appear when macro is ran.
    By jcirasola in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-16-2014, 12:44 PM
  2. Creating a MsgBox for a required data field
    By jcirasola in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2014, 02:53 PM
  3. Help required with developing a error msgbox when end date is before start date
    By Graeme Smith in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-05-2013, 11:56 PM
  4. Autofilter Criteria in Msgbox
    By hawkwind in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-10-2013, 12:12 PM
  5. Need MsgBox to trigger only when criteria met on both sheets
    By nohero in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 07-18-2011, 02:39 PM
  6. MsgBox (time based)
    By C.L.A.N. 0³ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2009, 03:34 PM
  7. [SOLVED] Msgbox based on If statement
    By Neil Jimack in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-11-2005, 07:06 PM

Tags for this Thread

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