+ Reply to Thread
Results 1 to 17 of 17

Why Message Boxes Repeat?

Hybrid View

Sgt Rock Why Message Boxes Repeat? 09-06-2014, 09:13 AM
Richard Buttrey Re: Why Message Boxes Repeat? 09-06-2014, 09:56 AM
MickG Re: Why Message Boxes Repeat? 09-06-2014, 10:04 AM
coolblue Re: Why Message Boxes Repeat? 09-06-2014, 10:08 AM
Sgt Rock Re: Why Message Boxes Repeat? 09-06-2014, 10:40 AM
Sgt Rock Re: Why Message Boxes Repeat? 09-06-2014, 10:45 AM
coolblue Why Message Boxes Repeat? 09-06-2014, 10:54 AM
Sgt Rock Re: Why Message Boxes Repeat? 09-06-2014, 11:17 AM
coolblue Re: Why Message Boxes Repeat? 09-06-2014, 11:25 AM
Sgt Rock Re: Why Message Boxes Repeat? 09-06-2014, 11:41 AM
coolblue Re: Why Message Boxes Repeat? 09-06-2014, 11:46 AM
Sgt Rock Re: Why Message Boxes Repeat? 09-06-2014, 12:03 PM
Sgt Rock Re: Why Message Boxes Repeat?... 09-07-2014, 07:49 AM
coolblue Re: Why Message Boxes Repeat? 09-07-2014, 03:07 PM
Sgt Rock Re: Why Message Boxes Repeat? 09-07-2014, 03:28 PM
xladept Re: Why Message Boxes Repeat? 09-07-2014, 04:21 PM
Sgt Rock Re: Why Message Boxes Repeat? 09-07-2014, 04:27 PM
  1. #1
    Registered User
    Join Date
    08-02-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Why Message Boxes Repeat?

    Apologize for the convoluted description - hence why I included the code.
    Have tried the Application...enable true/false to no avail - agree, "something" is triggering
    the msgboxes to show again, but on second time through, they do as they should - simply close.
    I first thought Exit Sub was not working...but that is not the case.
    Possibly, just possibly due to the fact it's the same cell (C4)for the change event - but also for the msgboxes as well...???
    Thoughts, suggestions?

    Cell C4 is a pull down of various chemicals from a table on a different worksheet - when the name changes - a column is cleared on the same worksheet as C4 - simple.
    However, and here's the kicker, if there happens to be a particular name in that cell, C4, e.g. lead (Pb), then I "invoke" a message box which asks a question.
    If the response is "yes" - then another message pop's up, whereupon I want to simply click OK, and exit, but it doesn't do that -
    goes back to the first message box. If I answer the same way Yes, the OK, it exits. Same is True if I initially answer "No" to the first msgbox - a subsequent message
    appears - simply making a statement, to which I click OK, and again should exit but does the same thing as above - goes again but on 2nd go through, it will exit.

    I most appreciate your viewing this since there are a gazillion questions on here and I do try my very best to solve on my own. Have done good so far in this program,
    but this issue as really thrown me for a big loop!!!

    Best weekend wishes,
    Sgt Rock (Mort in Dallas)

  2. #2
    Registered User
    Join Date
    08-02-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Why Message Boxes Repeat?

    FYI...did as you suggest and added the Application code...
    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    'This line of code clears the Activity column once a new chemical is selected from the select chemical drop down
    
    Application.EnableEvents = False
        If Not Intersect(Target, Target.Worksheet.Range("C4")) Is Nothing Then Call ClearColumn
                   
        If Range("C4").Value = "Lead" Then Call CheckForLead
    Application.EnableEvents = True
    End Sub
    Now no message boxes at all appear even if Lead appears in cell C4 - this strange issue has happened at lot - I change the code a lil bit, and it stops working - have to go back to
    the original workbook to get it going again...I'm stumped!!!
    Best, SR

  3. #3
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Why Message Boxes Repeat?

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    'This line of code clears the Activity column once a new chemical is selected from the select chemical drop down
    
    Application.EnableEvents = False
    
    On Error GoTo exitEnabled
    
        If Not Intersect(Target, Target.Worksheet.Range("C4")) Is Nothing Then Call ClearColumn
                   
        If Range("C4").Value = "Lead" Then Call CheckForLead
    
    exitEnabled:
    Application.EnableEvents = True
    End Sub

    Code edited to make it safe.
    Have you set a break point in the error handler and stepped through?
    And searched for other calls to CheckForLead?


    Sent from my iPad using Tapatalk

+ 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. Repeat Message box routine with IF condition and condnl formatting
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-18-2014, 02:39 AM
  2. Message Boxes
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2006, 02:32 PM
  3. How can I repeat a macro, and how can make it without any message?
    By emil in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-17-2006, 04:35 PM
  4. Message boxes
    By JaB in forum Excel General
    Replies: 1
    Last Post: 11-10-2005, 08:10 AM
  5. [SOLVED] Message Boxes.
    By Donny in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2005, 03:06 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