View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tim Zych[_4_] Tim Zych[_4_] is offline
external usenet poster
 
Posts: 58
Default List macros for user to select...

Create a userform (UserForm1) with a Listbox (ListBox1) and a button
(CommandButton1)

In the userform code area, paste in:

Private Sub CommandButton1_Click()
Dim i As Integer
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
Application.Run .List(i, 0)
End If
Next i
End With
End Sub

Private Sub UserForm_Initialize()
With Me.ListBox1
.AddItem "Macro1"
.AddItem "Macro2"
.AddItem "Macro3"
.AddItem "Macro4"
End With
End Sub

change the macro names to suit.

"ali" wrote in message
...
Hi,

I am trying to create a macro that will bring up a list of 4 macros,
allowing the user to select one of them from the list. On clicking ok
the macro is run.

Unfortunately i am at a complete loss as to how to do this. Can anyone
please help with this?

Also, is it possible to allow the user to select more than one macro
and on clicking ok the macros are run (macro 1 first, followed by macro
2)

Many thanks for your help on this topic


---
Message posted from http://www.ExcelForum.com/