Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default Assign Macros to a dropdown list

I have a dropdown list on an Excel sheet and would like to assign macros to
each of the 14 entries that are in the drowdown menu. I am able to assign a
single macro that runs when clicking on any name in the list but I want to
assign a different macro to each name in the list. Can that be done?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Assign Macros to a dropdown list

Not by assinging. In you single macro, you would use/examine the listindex
property and make a decision about which of the 14 macros to call.

--
Regards,
Tom Ogilvy

"JT" wrote in message
...
I have a dropdown list on an Excel sheet and would like to assign macros

to
each of the 14 entries that are in the drowdown menu. I am able to assign

a
single macro that runs when clicking on any name in the list but I want to
assign a different macro to each name in the list. Can that be done?
Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default Assign Macros to a dropdown list

Thanks for responding Tom. I have no idea what you are suggesting. I
attempted to find the "examine the listindex property" that you suggested but
did not see it. I am new to this type of programming in Excel/Visual Basic so
I forgive my being slow.
Thanks

"Tom Ogilvy" wrote:

Not by assinging. In you single macro, you would use/examine the listindex
property and make a decision about which of the 14 macros to call.

--
Regards,
Tom Ogilvy

"JT" wrote in message
...
I have a dropdown list on an Excel sheet and would like to assign macros

to
each of the 14 entries that are in the drowdown menu. I am able to assign

a
single macro that runs when clicking on any name in the list but I want to
assign a different macro to each name in the list. Can that be done?
Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Assign Macros to a dropdown list

Are you using a dropdown/combobox from the forms toolbar

Are you using a combobox from the control toolbox toolbar

Are you using the list option from Data=Validation (if so, what is the
earliest version of Excel that will need to load this workbook?)

--
Regards,
Tom Ogilvy

"JT" wrote in message
...
I have a dropdown list on an Excel sheet and would like to assign macros

to
each of the 14 entries that are in the drowdown menu. I am able to assign

a
single macro that runs when clicking on any name in the list but I want to
assign a different macro to each name in the list. Can that be done?
Thanks



  #5   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default Assign Macros to a dropdown list

I am using Excel 2003 and that version will be used by everyone viewing the
file. I inserted the dropdown box into the sheet using the forms toolbar.
That is as far as I got except for using the assign macro menu to get a
single macro to function when clicking on any of the names in the dropdown
box.

"Tom Ogilvy" wrote:

Are you using a dropdown/combobox from the forms toolbar

Are you using a combobox from the control toolbox toolbar

Are you using the list option from Data=Validation (if so, what is the
earliest version of Excel that will need to load this workbook?)

--
Regards,
Tom Ogilvy

"JT" wrote in message
...
I have a dropdown list on an Excel sheet and would like to assign macros

to
each of the 14 entries that are in the drowdown menu. I am able to assign

a
single macro that runs when clicking on any name in the list but I want to
assign a different macro to each name in the list. Can that be done?
Thanks






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Assign Macros to a dropdown list

Sub DropDown_Click()
dim drpdwn as DropDown
set drpdwn = ActiveSheet.Dropdowns(Application.Caller)
Select Case drpdwn.ListIndex
Case 0
' no selection, do nothing
Case 1
' Item1 selected
Macro1
Case 2
' item2 selected
Macro20
Case 3
' item3 selected
Macro5
Case 4 to 14
' one of item 4 to 14 selected
Macro2B
End Select
End Sub

as an example.

--
Regards,
Tom Ogilvy

"JT" wrote in message
...
I am using Excel 2003 and that version will be used by everyone viewing

the
file. I inserted the dropdown box into the sheet using the forms toolbar.
That is as far as I got except for using the assign macro menu to get a
single macro to function when clicking on any of the names in the dropdown
box.

"Tom Ogilvy" wrote:

Are you using a dropdown/combobox from the forms toolbar

Are you using a combobox from the control toolbox toolbar

Are you using the list option from Data=Validation (if so, what is the
earliest version of Excel that will need to load this workbook?)

--
Regards,
Tom Ogilvy

"JT" wrote in message
...
I have a dropdown list on an Excel sheet and would like to assign

macros
to
each of the 14 entries that are in the drowdown menu. I am able to

assign
a
single macro that runs when clicking on any name in the list but I

want to
assign a different macro to each name in the list. Can that be done?
Thanks






  #7   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default Assign Macros to a dropdown list

Thanks Tom for your help with this project. I was able to get your code
example to work in my Excel sheet with some editing. In working at this
project I have gained some knowlege at using Visual Basic as well.

Thanks Again for your help
Jeff

"Tom Ogilvy" wrote:

Sub DropDown_Click()
dim drpdwn as DropDown
set drpdwn = ActiveSheet.Dropdowns(Application.Caller)
Select Case drpdwn.ListIndex
Case 0
' no selection, do nothing
Case 1
' Item1 selected
Macro1
Case 2
' item2 selected
Macro20
Case 3
' item3 selected
Macro5
Case 4 to 14
' one of item 4 to 14 selected
Macro2B
End Select
End Sub

as an example.

--
Regards,
Tom Ogilvy

"JT" wrote in message
...
I am using Excel 2003 and that version will be used by everyone viewing

the
file. I inserted the dropdown box into the sheet using the forms toolbar.
That is as far as I got except for using the assign macro menu to get a
single macro to function when clicking on any of the names in the dropdown
box.

"Tom Ogilvy" wrote:

Are you using a dropdown/combobox from the forms toolbar

Are you using a combobox from the control toolbox toolbar

Are you using the list option from Data=Validation (if so, what is the
earliest version of Excel that will need to load this workbook?)

--
Regards,
Tom Ogilvy

"JT" wrote in message
...
I have a dropdown list on an Excel sheet and would like to assign

macros
to
each of the 14 entries that are in the drowdown menu. I am able to

assign
a
single macro that runs when clicking on any name in the list but I

want to
assign a different macro to each name in the list. Can that be done?
Thanks






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
dropdown list determined by another dropdown list Wackyracer Excel Discussion (Misc queries) 5 April 27th 09 10:49 PM
Running Macros by selecting from a dropdown list FionaR Excel Discussion (Misc queries) 3 January 3rd 07 01:24 PM
result of selecting from the dropdown list should be a dropdown list No News Excel Worksheet Functions 0 July 5th 06 04:09 PM
result of selecting from the dropdown list should be a dropdown list No News Excel Worksheet Functions 2 July 1st 06 10:53 AM
Dropdown box of macros Gary Phillips Excel Programming 1 July 12th 04 06:44 PM


All times are GMT +1. The time now is 05:37 PM.

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"