View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Benway Benway is offline
external usenet poster
 
Posts: 4
Default How to run macros from combobox selection

Hello.
I've tried everything I can think of using the code below and cannot get
even MsgBox to show according to the selection. If anyone has a working
example, I'd be most appreciative!
Example one:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim Addx As String
Dim Rng As Range

Addx = Target.Validation.Formula1
Set Rng = Range(Right(Addx, Len(Addx) - 1))

If Target.Address = "$A$1" Then
Select Case Target.Value
Case Is = Rng.Cells(1, 1) 'First Drop Down Item
'Call RandD
MsgBox "Macro 01"
Case Is = Rng.Cells(2, 1) 'Second Drop Down Item
'Call MacroB
MsgBox "Macro 02"
Case Is = Rng.Cells(3, 1) 'Third Drop Down Item
'Call MacroC
MsgBox "Macro 03"
End Select
End If

End Sub
============================
Example two:
Sub combo1_Change()
Select Case combo1.Value
Case "This"
MsgBox "This"
Case "That"
MsgBox "That"
Case "The Other Thing"
MsgBox "The Other Thing"
End Select
End Sub