![]() |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 02:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com