Message Popup From Drop Down Click

  • Thread starter Thread starter margolis22
  • Start date Start date
M

margolis22

I have a drop down box with several options. I want a message box t
popup when the user clicks on an option from drop down list.

Here is my current code (which is way off)

Private Sub OnClick(ByVal Target As Range)
Dim curr As String
curr = Range("Index!F1").String

If curr = 2 Then
MsgBox ("Currency Selected ==> Dollars - U.S.A.")
Else
If curr = 3 Then
MsgBox ("Currency Selected ==> Francs - France. The rate factor is 1.2
From January 26, 2004")
Else
If curr = 4 Then
MsgBox ("Currency Selected ==> Canadian - Canada. The rate factor i
1.20 From January 26, 2004")
Else
If curr = 5 Then
MsgBox ("Currency Selected ==> Pesos - Mexico. The rate factor is 1.2
From January 26, 2004")
End If
End If
End If
End If
End Su
 
Dropdowns sound like you used a dropdown from the Forms toolbar on a
worksheet???

If this is correct, then maybe this'll give you an idea:

Option Explicit
Sub OnClick2()

Dim myDropDown As DropDown
Dim Msg As String

Set myDropDown = ActiveSheet.DropDowns(Application.Caller)

With myDropDown
If .ListIndex = 0 Then
Exit Sub
Else
Select Case .ListIndex
Case Is = 2: Msg = "usa message"
Case Is = 3: Msg = "french message"
Case Is = 4: Msg = "canadian message"
Case Is = 5: Msg = "mexican message"
Case Else: Msg = "design error??"
End Select
End If
End With

MsgBox Msg

End Sub
 
Back
Top