+ Reply to Thread
Results 1 to 17 of 17

Why Message Boxes Repeat?

Hybrid View

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

    Re: Why Message Boxes Repeat?

    Most appreciate CoolBlue!!!
    Have never heard of debug.print - will Google
    Do about the Immediate window though

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

    Re: Why Message Boxes Repeat? - SOLVED!!!

    After everyone's assistance I feel it only fitting to post the VBA code that works. An associate was able to steer me
    in the right direction. I almost had it. Again the issue was with a "worksheet change event" and having a "second event"
    on the same cell to test. 1st event, is clear a column in a Table once cell C4 is changed to a new chemical.
    2nd event is if cell C4 = Lead then give some msgboxes stating various issues with Lead. You can "see" the messages
    in the code below. Hopefully this code may be of some use for someone to use in a "look-a-like" situation?

    Best wishes to the Forum and their helpfulness!!
    Sgt Rock (Mort in Dallas)

    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
    
    If Not Intersect(Target, Target.Worksheet.Range("C4")) Is Nothing Then
         With Worksheets("Threshold").ListObjects("ThresholdInputTable").ListColumns("ActivityTRIChemical")
            .DataBodyRange.ClearContents
         End With
         
    'If Lead is selected as the chemical whose threshold needs to be calculated
    'Warn the user that threshold could be the original 25,000 lbs/yr - 10,000 lbs/year (if contained in certain metals)
    'Or that the lower 100 lbs/year PBT thrshold might apply
        
         If Range("C4").Value = "Lead" Then
            
            Dim myTitle As String
            Dim MyMsg As String
            Dim Response As VbMsgBoxResult
                
                If Worksheets("Threshold").Range("C4").Value = "Lead" Then
                     myTitle = "Qualify Lead & Lead Compounds"
                     MyMsg = "Is the lead contained in stainless steel, brass, or bronze alloy?"
                     Response = MsgBox(MyMsg, vbQuestion + vbYesNo, myTitle)
           
                     If Response = vbYes Then
                        MsgBox "The normal thresholds of 25,000 pounds (Mfg,Proc) or 10,000 pounds (OWU) apply"
                        Exit Sub
                     End If
            
                     If Response = vbNo Then
                        MsgBox "The PBT 100 pound theshold applies to lead in all activities"
                        Exit Sub
                     End If
                End If
        End If
    End If
               
    End Sub

+ 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. [SOLVED] 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. 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