+ Reply to Thread
Results 1 to 4 of 4

How do I trigger a macro by selecting from a dropdown list?

  1. #1
    Modell
    Guest

    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. #2
    Jim Thomlinson
    Guest

    RE: 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. #3
    Modell
    Guest

    RE: 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. #4
    Modell
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1