I have created a listbox from the forms toolbar in Excel 2007. What I would like is to assign a macro to the listbox, so that when a selection is made from the list, a specified macro will run. I googled and found some VBA code online that I have tried to use, but it is not working. I have 12 selections on the listbox; I have only included two in this code (what's the point of adding more until I can get it working!). I would appreciate any assistance.
This is the code I am using:
Sub EndorsementTypeListbox()
Dim sName As String, vVal As String
Dim lbox As ListBox
sName = Application.Caller
Set lbox = ActiveSheet.ListBoxes(sName)
vVal = lbox.List(lbox.ListIndex)
Select Case LCase(vVal)
Case "HCP - Add Beds"
HCPAddBeds
Case "HCP - Add Facility"
HCPAddFacility
End Select
End Sub
Much appreciated,
Stephanie
This is the code I am using:
Sub EndorsementTypeListbox()
Dim sName As String, vVal As String
Dim lbox As ListBox
sName = Application.Caller
Set lbox = ActiveSheet.ListBoxes(sName)
vVal = lbox.List(lbox.ListIndex)
Select Case LCase(vVal)
Case "HCP - Add Beds"
HCPAddBeds
Case "HCP - Add Facility"
HCPAddFacility
End Select
End Sub
Much appreciated,
Stephanie