+ Reply to Thread
Results 1 to 3 of 3

Stop Message Box looping when OK is selected

  1. #1
    Registered User
    Join Date
    07-02-2011
    Location
    Hamilton, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    28

    Question Stop Message Box looping when OK is selected

    Hi, I have set up a message box to come up under a certain condition, but when I click the OK button it keeps appearing. I'm pretty sure it's because the focus is set to a value in a listbox, which is what invokes the message box, and each time I click OK this behaviour repeats, resulting in the message box looping. I'm a beginner to all of this, I'll attach the document. The code in question is in Sheet1 (BM) and the segment of code is within this as follows:

    If Me.ListBox1.Value = "AFW" And Cells(1, i) <> "AFW" Then
    MsgBox "No specific tests have been created for this wizard, please update the script"
    Else

    'hide and exclude column
    Columns(i).Hidden = True
    Cells(4, i) = "x"

    Excuse the messiness of the code, as I said I'm new to this and just want to get it working for the moment.

    Thanks so muchBM - All Wizard Ribbons_v3.xlsm

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Stop Message Box looping when OK is selected

    Hi

    It keeps coming up as it is processing every column from 4 to nEndCl (currently 79) so it is doing exactly what you have told it to do ie put out the message if the value in D1, E1, F1 etc doesn't match the value selected from the listbox.

    Exactly what is it you want to do when you select an item from the listbox?

    rylo

  3. #3
    Registered User
    Join Date
    07-02-2011
    Location
    Hamilton, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Stop Message Box looping when OK is selected

    Good question, I was looking at the big picture. I just needed an end statement after the msgbox appeared. Thanks for your help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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