dj44
03-22-2017, 08:31 AM
Hi folks,
I made a list box.
I am trying to run a macro when the item is selected
Column 1 list box list index
Column 2 macro name to run
eg
0 Macro1
1 Macro2
2 Macro 3
it is populated from the worksheet list
Private Sub ListBox100_Change()
Dim ws As Worksheet
Dim i As Integer
Set ws = Worksheets("Macros")
For i = 3 To 7
If ListBox100.ListIndex = ws.Cells(i, 1).Value Then 'Listindex
Application.Run ws.Cells(i, 2).Value ' Macro name to run
'Call ws.Cells(i, 5).Value
End If
Next i
End Sub
it was at some point working but now the error says
on the applicaiton.run line
i have set the row source to column 1
any ideas what it could be
I made a list box.
I am trying to run a macro when the item is selected
Column 1 list box list index
Column 2 macro name to run
eg
0 Macro1
1 Macro2
2 Macro 3
it is populated from the worksheet list
Private Sub ListBox100_Change()
Dim ws As Worksheet
Dim i As Integer
Set ws = Worksheets("Macros")
For i = 3 To 7
If ListBox100.ListIndex = ws.Cells(i, 1).Value Then 'Listindex
Application.Run ws.Cells(i, 2).Value ' Macro name to run
'Call ws.Cells(i, 5).Value
End If
Next i
End Sub
it was at some point working but now the error says
on the applicaiton.run line
i have set the row source to column 1
any ideas what it could be