Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi ,
I have a list box populated with 5 items, lets call them Monday-Friday, how can I trigger I separate macro , on each selection , rather than the default one for the listbox. Any help will be gratefully received. Cheers Jamie -- --------------------------------------------------------------------- "Are you still wasting your time with spam?... There is a solution!" Protected by GIANT Company's Spam Inspector The most powerful anti-spam software available. http://www.giantcompany.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jamie
You can't. You let the only default one decide which one to call from itself, like this: Select Case Listbox1.Listindex Case 0 Call Macro15 Case 1 Call Macro306 Case 2 Call YourParents Case Else Call FormatHarddrive End Select -- HTH. Best wishes Harald Followup to newsgroup only please. "hammer" wrote in message ... Hi , I have a list box populated with 5 items, lets call them Monday-Friday, how can I trigger I separate macro , on each selection , rather than the default one for the listbox. Any help will be gratefully received. Cheers Jamie -- --------------------------------------------------------------------- "Are you still wasting your time with spam?... There is a solution!" Protected by GIANT Company's Spam Inspector The most powerful anti-spam software available. http://www.giantcompany.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can use a Select Case statement in your default procedure which uses the
return value to run a specified procedure. -- David Hager Excel FMVP "hammer" wrote in message ... Hi , I have a list box populated with 5 items, lets call them Monday-Friday, how can I trigger I separate macro , on each selection , rather than the default one for the listbox. Any help will be gratefully received. Cheers Jamie -- --------------------------------------------------------------------- "Are you still wasting your time with spam?... There is a solution!" Protected by GIANT Company's Spam Inspector The most powerful anti-spam software available. http://www.giantcompany.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Run a Select Case statement based on the ListBox value, within the
Lisbox_Click procedure. HTH Roger Shaftesbury (UK) "hammer" wrote in message ... Hi , I have a list box populated with 5 items, lets call them Monday-Friday, how can I trigger I separate macro , on each selection , rather than the default one for the listbox. Any help will be gratefully received. Cheers Jamie -- --------------------------------------------------------------------- "Are you still wasting your time with spam?... There is a solution!" Protected by GIANT Company's Spam Inspector The most powerful anti-spam software available. http://www.giantcompany.com |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry i should clarify I want to do this within excel, I don't know much
VB , Simple instructions would help. cheers all thanks for swift reply . jamie -- --------------------------------------------------------------------- "Are you still wasting your time with spam?... There is a solution!" Protected by GIANT Company's Spam Inspector The most powerful anti-spam software available. http://www.giantcompany.com "hammer" wrote in message ... Hi , I have a list box populated with 5 items, lets call them Monday-Friday, how can I trigger I separate macro , on each selection , rather than the default one for the listbox. Any help will be gratefully received. Cheers Jamie -- --------------------------------------------------------------------- "Are you still wasting your time with spam?... There is a solution!" Protected by GIANT Company's Spam Inspector The most powerful anti-spam software available. http://www.giantcompany.com |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"hammer" wrote in message
... Sorry i should clarify I want to do this within excel, I don't know much VB , Simple instructions would help. Is the list in a spreadsheet or a userform or a dialog sheet ? Is it from the Forms toolbar or from the controls toolbax ? How do you populate your list, is it a macro too ? When do you want the macro to run, on clicking/arrowing to an item in the list or on clicking an OK button after that ? Apoliges for asking all this, but detailed info needs detailed background. -- HTH. Best wishes Harald Followup to newsgroup only please. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ok , thanks for help I will try to explain best I can,
the listbox is in a spreadsheet and is from the controls toolbox, I have typed in the 5 entries, and I would like the macro to run with the entry is highlighted/clicked on. Thanks again for the help, greatly appreciated Jamie -- --------------------------------------------------------------------- "Are you still wasting your time with spam?... There is a solution!" Protected by GIANT Company's Spam Inspector The most powerful anti-spam software available. http://www.giantcompany.com "Harald Staff" wrote in message ... "hammer" wrote in message ... Sorry i should clarify I want to do this within excel, I don't know much VB , Simple instructions would help. Is the list in a spreadsheet or a userform or a dialog sheet ? Is it from the Forms toolbar or from the controls toolbax ? How do you populate your list, is it a macro too ? When do you want the macro to run, on clicking/arrowing to an item in the list or on clicking an OK button after that ? Apoliges for asking all this, but detailed info needs detailed background. -- HTH. Best wishes Harald Followup to newsgroup only please. |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In design mode, rightclick the listbox, choose View Code, paste the following into the
blank (?) sheet module that appear: Private Sub ListBox1_Click() Select Case ListBox1.ListIndex Case 0 Call Macro1 Case 1 Call Macro2 Case Else Beep End Select End Sub Sub Macro1() MsgBox "Yo" End Sub Sub Macro2() MsgBox "Cheers" End Sub Replace "ListBox1" with whatever name the listbox has. And Macro1, 2 actions with what you want done. -- HTH. Best wishes Harald Followup to newsgroup only please. "hammer" wrote in message ... ok , thanks for help I will try to explain best I can, the listbox is in a spreadsheet and is from the controls toolbox, I have typed in the 5 entries, and I would like the macro to run with the entry is highlighted/clicked on. |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Well I am amazed at the speed and helpfulness of this group.
many thanks Jamie :) -- --------------------------------------------------------------------- "Are you still wasting your time with spam?... There is a solution!" Protected by GIANT Company's Spam Inspector The most powerful anti-spam software available. http://www.giantcompany.com "Harald Staff" wrote in message ... In design mode, rightclick the listbox, choose View Code, paste the following into the blank (?) sheet module that appear: Private Sub ListBox1_Click() Select Case ListBox1.ListIndex Case 0 Call Macro1 Case 1 Call Macro2 Case Else Beep End Select End Sub Sub Macro1() MsgBox "Yo" End Sub Sub Macro2() MsgBox "Cheers" End Sub Replace "ListBox1" with whatever name the listbox has. And Macro1, 2 actions with what you want done. -- HTH. Best wishes Harald Followup to newsgroup only please. "hammer" wrote in message ... ok , thanks for help I will try to explain best I can, the listbox is in a spreadsheet and is from the controls toolbox, I have typed in the 5 entries, and I would like the macro to run with the entry is highlighted/clicked on. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Userform combo box triggering macros | Excel Discussion (Misc queries) | |||
Function triggering a macro | Excel Worksheet Functions | |||
Daily Macro Triggering | Excel Discussion (Misc queries) | |||
Triggering click event of a menu in vba | Excel Programming | |||
List the Macros that can be executed from Tools-Macros | Excel Programming |