+ Reply to Thread
Results 1 to 17 of 17

VBA MsgBox on Criteria

  1. #1
    Registered User
    Join Date
    11-07-2009
    Location
    England
    MS-Off Ver
    Office 2007
    Posts
    46

    VBA MsgBox on Criteria

    This is also posted on Stack Overflow - http://stackoverflow.com/questions/4...99632_43777862

    I have been learning VBA as I go when developing a spreadsheet, I am stuck with a particular issue though.

    Please see below code;

    Please Login or Register  to view this content.
    My issue is the "If active row does not have Event Held data, ask if wants to add or not" part, the MsgBox pops up on every SearchButton_Click. Where I only want it to popup when the searched booking number has no data in column K.

    I'm sure it's something simple and I'm probably going to feel like an idiot, but I just cannot work it out.

    NB I have tried putting my code in before the Loop however it just gives me a Loop error.
    Attached Files Attached Files
    Last edited by Janbi; 05-04-2017 at 07:24 AM.

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    O365 V2408
    Posts
    15,138

    Re: VBA MsgBox on Criteria

    Hi Janbi

    Try this:
    Please Login or Register  to view this content.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    11-07-2009
    Location
    England
    MS-Off Ver
    Office 2007
    Posts
    46

    Re: VBA MsgBox on Criteria

    That is not working unfortunately

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    O365 V2408
    Posts
    15,138

    Re: VBA MsgBox on Criteria

    Why not upload a sample workbook

  5. #5
    Registered User
    Join Date
    11-07-2009
    Location
    England
    MS-Off Ver
    Office 2007
    Posts
    46

    Re: VBA MsgBox on Criteria

    Too big to upload apparently.

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: VBA MsgBox on Criteria

    @Janbi

    Please note the forum rule on cross-posting and provide the relevant link(s) before a moderator tells you off.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  7. #7
    Registered User
    Join Date
    11-07-2009
    Location
    England
    MS-Off Ver
    Office 2007
    Posts
    46

    Re: VBA MsgBox on Criteria

    Done, sorry didn't know.

  8. #8
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: VBA MsgBox on Criteria

    Too big to upload apparently.
    All that is needed is a representative sample of your data, suitably anonymised...

    You are relying on people giving their time, freely, to help you. The least you can do is provide what is asked for to assist in providing you with a solution to your problem.

  9. #9
    Registered User
    Join Date
    11-07-2009
    Location
    England
    MS-Off Ver
    Office 2007
    Posts
    46

    Re: VBA MsgBox on Criteria

    I am trying, please do not act like I am not.

    My anonymised file is 10MB, I am unable to upload it as an attachment to this thread.

    EDIT: I have tried zipping the file and uploading it that way, however I get an upload failed error.

  10. #10
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    O365 V2408
    Posts
    15,138

    Re: VBA MsgBox on Criteria

    .................Deleted...................

  11. #11
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: VBA MsgBox on Criteria

    Copy only relevant sheet to a new file. Then keep only 20 rows of data there and delete else. Also delete all the images if any. Then upload that file. It shouldn't be more than 200kb as I guess.
    Sanjib Debnath

    If you have found anyone helpful then please click on the Add Reputation (*) at the left hand side and say thanks to him.

    If you have found any solution to your thread then please confirm us about the solution and mark your thread as solved by doing below simple steps :
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  12. #12
    Registered User
    Join Date
    11-07-2009
    Location
    England
    MS-Off Ver
    Office 2007
    Posts
    46

    Re: VBA MsgBox on Criteria

    I do apologise, the reason my file was so big is because I had an infinite formula in one of the columns.

    I have now attached the worksheet to my original post.

  13. #13
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: VBA MsgBox on Criteria

    Am struggling to understand the logic, but that's just me.

    I might suggest adding an
    Please Login or Register  to view this content.
    after the value of EventHeldComboBox is set.

  14. #14
    Registered User
    Join Date
    11-07-2009
    Location
    England
    MS-Off Ver
    Office 2007
    Posts
    46

    Re: VBA MsgBox on Criteria

    Quote Originally Posted by cytop View Post
    Am struggling to understand the logic, but that's just me.

    I might suggest adding an
    Please Login or Register  to view this content.
    after the value of EventHeldComboBox is set.
    Hi Cytop, that does not work unfortunately.

    This is what I am trying to achieve, for the EventHeldUserForm.

    You search for a Booking Number, if that row has no data in Column K (Event Held), then show MsgBox asking if user would like to input data, if they click No, then clear the form.
    If that row does have data in Column K, then simply display it in the EventHeldComboBox.

    Hope this helps and thank you for your assistance.

  15. #15
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: VBA MsgBox on Criteria

    Perhaps a slight rewrite - it might make the logic flow a little clearer
    Please Login or Register  to view this content.
    But I'm not sure I understand the logic myself.

  16. #16
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: VBA MsgBox on Criteria

    Similar to cytop's but using "Application.Match"
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    11-07-2009
    Location
    England
    MS-Off Ver
    Office 2007
    Posts
    46

    Re: VBA MsgBox on Criteria

    Thank you both Cytop and CK76, both solutions work for me, I went with CK76's in the end simply because the user could change the Event Held data if needed.

+ 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] VBA MsgBox pop up required based on two criteria.
    By Declamatory in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-14-2015, 08:57 AM
  2. Macro to capture MsgBox prompt to a string variable but ignore the MsgBox
    By BuglerDobbs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2015, 10:56 AM
  3. [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
  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-center the message on a msgbox
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-11-2007, 06:48 AM
  7. [SOLVED] MsgBox-at the end a msgBox popup
    By CC in forum Excel General
    Replies: 4
    Last Post: 05-05-2006, 12:50 PM

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