Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am a relatively new user of macros, and I am trying to write one which changes the selection in dropdown boxes. I can create the dropdowns via Data | Validation or the Forms toolbar. Example, the 1st dropdown contains Selection 1 and Selection 2 as options, and the 2nd dropdown contains Event 1 and Event 2 as options. I am trying to write one macro that would change the dropdowns to select Selection 1 and Event 2, and another macro that would change the dropdowns to show Selection 2 and Event 1. Thank you for the help. Graeme |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You would just write the appropriate value to the cell that contains the data
validation. for illustration purposes, I will assume that on the activesheet, the selection dropdown is in B9 and the Event dropdown is in C9. Then you would use code like this. Sub macro1 Range("B9").Value = "Selection 1" Range("C9").Value = "Event 2" End Sub Sub macro2 Range("B9").Value = "Selection 2" Range("C9").Value = "Event 1" End Sub an alternative approach Sub Macro1() Range("B9:C9").Vaue = Array("Selection 1","Event 2") End Sub Sub Macro2() Range("B9:C9").Vaue = Array("Selection 2","Event 1") End Sub -- Regards, Tom Ogilvy "Graeme" wrote: Hi, I am a relatively new user of macros, and I am trying to write one which changes the selection in dropdown boxes. I can create the dropdowns via Data | Validation or the Forms toolbar. Example, the 1st dropdown contains Selection 1 and Selection 2 as options, and the 2nd dropdown contains Event 1 and Event 2 as options. I am trying to write one macro that would change the dropdowns to select Selection 1 and Event 2, and another macro that would change the dropdowns to show Selection 2 and Event 1. Thank you for the help. Graeme |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom,
Thanks for that great tip again! I mentioned this a few years back: It's time to put your wealth of knowledge into a book, so we all can have a "Tom" of our own next to our keyboard. Thanks, Ben -- "Tom Ogilvy" wrote: You would just write the appropriate value to the cell that contains the data validation. for illustration purposes, I will assume that on the activesheet, the selection dropdown is in B9 and the Event dropdown is in C9. Then you would use code like this. Sub macro1 Range("B9").Value = "Selection 1" Range("C9").Value = "Event 2" End Sub Sub macro2 Range("B9").Value = "Selection 2" Range("C9").Value = "Event 1" End Sub an alternative approach Sub Macro1() Range("B9:C9").Vaue = Array("Selection 1","Event 2") End Sub Sub Macro2() Range("B9:C9").Vaue = Array("Selection 2","Event 1") End Sub -- Regards, Tom Ogilvy "Graeme" wrote: Hi, I am a relatively new user of macros, and I am trying to write one which changes the selection in dropdown boxes. I can create the dropdowns via Data | Validation or the Forms toolbar. Example, the 1st dropdown contains Selection 1 and Selection 2 as options, and the 2nd dropdown contains Event 1 and Event 2 as options. I am trying to write one macro that would change the dropdowns to select Selection 1 and Event 2, and another macro that would change the dropdowns to show Selection 2 and Event 1. Thank you for the help. Graeme |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There are some great books out there already. I would just be diluting the
market, but thanks for the support. The advantage of doing it here is there is a better "index" and the suggestions are more specifically focused. <g -- Regards, Tom Ogilvy "Ben" wrote: Tom, Thanks for that great tip again! I mentioned this a few years back: It's time to put your wealth of knowledge into a book, so we all can have a "Tom" of our own next to our keyboard. Thanks, Ben -- "Tom Ogilvy" wrote: You would just write the appropriate value to the cell that contains the data validation. for illustration purposes, I will assume that on the activesheet, the selection dropdown is in B9 and the Event dropdown is in C9. Then you would use code like this. Sub macro1 Range("B9").Value = "Selection 1" Range("C9").Value = "Event 2" End Sub Sub macro2 Range("B9").Value = "Selection 2" Range("C9").Value = "Event 1" End Sub an alternative approach Sub Macro1() Range("B9:C9").Vaue = Array("Selection 1","Event 2") End Sub Sub Macro2() Range("B9:C9").Vaue = Array("Selection 2","Event 1") End Sub -- Regards, Tom Ogilvy "Graeme" wrote: Hi, I am a relatively new user of macros, and I am trying to write one which changes the selection in dropdown boxes. I can create the dropdowns via Data | Validation or the Forms toolbar. Example, the 1st dropdown contains Selection 1 and Selection 2 as options, and the 2nd dropdown contains Event 1 and Event 2 as options. I am trying to write one macro that would change the dropdowns to select Selection 1 and Event 2, and another macro that would change the dropdowns to show Selection 2 and Event 1. Thank you for the help. Graeme |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom - thank you.
"Tom Ogilvy" wrote: There are some great books out there already. I would just be diluting the market, but thanks for the support. The advantage of doing it here is there is a better "index" and the suggestions are more specifically focused. <g -- Regards, Tom Ogilvy "Ben" wrote: Tom, Thanks for that great tip again! I mentioned this a few years back: It's time to put your wealth of knowledge into a book, so we all can have a "Tom" of our own next to our keyboard. Thanks, Ben -- "Tom Ogilvy" wrote: You would just write the appropriate value to the cell that contains the data validation. for illustration purposes, I will assume that on the activesheet, the selection dropdown is in B9 and the Event dropdown is in C9. Then you would use code like this. Sub macro1 Range("B9").Value = "Selection 1" Range("C9").Value = "Event 2" End Sub Sub macro2 Range("B9").Value = "Selection 2" Range("C9").Value = "Event 1" End Sub an alternative approach Sub Macro1() Range("B9:C9").Vaue = Array("Selection 1","Event 2") End Sub Sub Macro2() Range("B9:C9").Vaue = Array("Selection 2","Event 1") End Sub -- Regards, Tom Ogilvy "Graeme" wrote: Hi, I am a relatively new user of macros, and I am trying to write one which changes the selection in dropdown boxes. I can create the dropdowns via Data | Validation or the Forms toolbar. Example, the 1st dropdown contains Selection 1 and Selection 2 as options, and the 2nd dropdown contains Event 1 and Event 2 as options. I am trying to write one macro that would change the dropdowns to select Selection 1 and Event 2, and another macro that would change the dropdowns to show Selection 2 and Event 1. Thank you for the help. Graeme |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Record Macro and Edit Macro options disabled | New Users to Excel | |||
include macros in another macro | Excel Programming | |||
Need help updating my macro to include a 2nd worksheet. | Excel Worksheet Functions | |||
Record Macro - Record custom user actions | Excel Programming | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming |