Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Record macro to include changes in dropdowns

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Record macro to include changes in dropdowns

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   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Record macro to include changes in dropdowns

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Record macro to include changes in dropdowns

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Record macro to include changes in dropdowns

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
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
Record Macro and Edit Macro options disabled Huzza New Users to Excel 1 March 18th 09 03:55 PM
include macros in another macro jnewl Excel Programming 2 March 13th 06 08:50 PM
Need help updating my macro to include a 2nd worksheet. billrl34 Excel Worksheet Functions 0 December 9th 05 08:06 PM
Record Macro - Record custom user actions Sal[_4_] Excel Programming 1 December 23rd 04 03:18 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM


All times are GMT +1. The time now is 11:15 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"