Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How do I trigger a macro by selecting from a dropdown list?

I have a validation list set up as well as a macro related to the information
in that list. I want to be able to select something from the list and have a
macro automatically run.

Currently, I have a separate button that I have to push that runs the macro,
but I want to eliminate this step.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default How do I trigger a macro by selecting from a dropdown list?

You want to trigger the change event something like this...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
MsgBox "Call your macro"
End If
End Sub

Change the $A$1 to the cell address of the cell with your validation list...
--
HTH...

Jim Thomlinson


"Modell" wrote:

I have a validation list set up as well as a macro related to the information
in that list. I want to be able to select something from the list and have a
macro automatically run.

Currently, I have a separate button that I have to push that runs the macro,
but I want to eliminate this step.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How do I trigger a macro by selecting from a dropdown list?

Jim,
2 questions:
1. Do I replace the "Worksheet_Change(ByVal Target As Range)" with the name
of the worksheet in my spreadsheet?
2. Do I replace "Call your macro" with the name of the macro I want to
automatically run?

Thanks for your help.

"Jim Thomlinson" wrote:

You want to trigger the change event something like this...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
MsgBox "Call your macro"
End If
End Sub

Change the $A$1 to the cell address of the cell with your validation list...
--
HTH...

Jim Thomlinson


"Modell" wrote:

I have a validation list set up as well as a macro related to the information
in that list. I want to be able to select something from the list and have a
macro automatically run.

Currently, I have a separate button that I have to push that runs the macro,
but I want to eliminate this step.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default How do I trigger a macro by selecting from a dropdown list?

Jim,
I got it to work. Thanks for your help!

"Modell" wrote:

Jim,
2 questions:
1. Do I replace the "Worksheet_Change(ByVal Target As Range)" with the name
of the worksheet in my spreadsheet?
2. Do I replace "Call your macro" with the name of the macro I want to
automatically run?

Thanks for your help.

"Jim Thomlinson" wrote:

You want to trigger the change event something like this...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
MsgBox "Call your macro"
End If
End Sub

Change the $A$1 to the cell address of the cell with your validation list...
--
HTH...

Jim Thomlinson


"Modell" wrote:

I have a validation list set up as well as a macro related to the information
in that list. I want to be able to select something from the list and have a
macro automatically run.

Currently, I have a separate button that I have to push that runs the macro,
but I want to eliminate this step.

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
how do I get one dropdown menu to trigger another one in excel totally lost[_2_] Excel Discussion (Misc queries) 2 April 5th 10 09:11 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 list to activate Macro Brad Excel Programming 6 May 25th 05 08:35 PM


All times are GMT +1. The time now is 12:07 PM.

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

About Us

"It's about Microsoft Excel"