Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default triggering different macros from list box?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default triggering different macros from list box?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default triggering different macros from list box?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default triggering different macros from list box?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default triggering different macros from list box?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default triggering different macros from list box?

"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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default triggering different macros from list box?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default triggering different macros from list box?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default triggering different macros from list box?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform combo box triggering macros michaelberrier Excel Discussion (Misc queries) 6 June 10th 06 01:25 PM
Function triggering a macro Leon Excel Worksheet Functions 1 December 22nd 05 07:26 AM
Daily Macro Triggering JB2010 Excel Discussion (Misc queries) 2 November 2nd 05 04:28 PM
Triggering click event of a menu in vba steve Excel Programming 4 August 19th 03 06:17 PM
List the Macros that can be executed from Tools-Macros Rob Bovey Excel Programming 1 July 10th 03 05:34 PM


All times are GMT +1. The time now is 09:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"