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
Bookmarks