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