I am Googled and Forum searched out! Most likely there is a simple explanation for this, but I have yet to find it.
How to put in words....I have a worksheet change event on a particular cell. If that cell changes then a sub is called
to "do something." If the cell = a specified name, another sub is called to display a first msgbox, and depending on
the response (Yes or No) either of 2 msgboxes are displayed. Let's say if "Yes" is clicked, msgbox 2 is displayed,
to which OK is clicked. On the other hand if "No" is clicked on the first msgbox, msgbox 3 is displayed, to which
OK is also clicked. The problem is if I answer "Yes" on the 1st msgbox, and OK on the 2nd msg box, they repeat.
That is, I see msgbox 1 again, and I click "Yes" again, but this time when msgbox 2 appears and I click OK, this
time it disappears like it should. The same thing happens if "No" is selected on the 1st msgbox. I think(?) it has to
do with the worksheet change event? There are supposed fixes - Application.??? = false/true - forgot the second
term, but that didn't work. I guess it would help to post the code - Any assistance would be most, most appreciated,
since I at wits end trying to figure out what I'm doing wrong. Thank you all in Advance!!! It is the sub - CheckForLead
that is giving me fits! Sgt. Rock!!
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
If Not Intersect(Target, Target.Worksheet.Range("C4")) Is Nothing Then Call ClearColumn
If Range("C4").Value = "Lead" Then Call CheckForLead
End Sub
Sub ClearColumn()
With Worksheets("Threshold").ListObjects("ThresholdInputTable").ListColumns("ActivityTRIChemical")
.DataBodyRange.ClearContents
End With
End Sub
Sub CheckForLead()
'Check if lead is contained in stainless steel, brass or bronze alloy
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"
ElseIf Response = vbNo Then
MsgBox "The PBT 100 pound theshold applies to lead in all activities"
Exit Sub
End If
End If
End Sub
Bookmarks