+ Reply to Thread
Results 1 to 2 of 2

How to Specify Trigger Event for Macro(s) with Dropdown List

Hybrid View

  1. #1
    Registered User
    Join Date
    04-08-2010
    Location
    Montreal
    MS-Off Ver
    2003 & 2010
    Posts
    16

    How to Specify Trigger Event for Macro(s) with Dropdown List

    Hello.
    I have found some information on the following type of code:

    Private Sub Worksheet_Change(ByVal Target As Range)
    etc.
    However, I do not understand it. I have a validated dropdown list on cell B3. I want Macro1 and Macro2 to run one after the other everytime I change the selection on my dropdown list.

    Thanks!

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: How to Specify Trigger Event for Macro(s) with Dropdown List

    Agimcomas,

    Try this.


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
    2. Select the worksheet in which your code is to run
    3. Right click on the sheet tab and choose View Code, to open the Visual Basic Editor
    4. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    5. Press the keys ALT + Q to exit the Editor, and return to Excel


    
    Private Sub Worksheet_Change(ByVal Target As Range)
    ' stanleydgromjr, 05/27/2011
    ' http://www.excelforum.com/excel-general/777772-how-to-specify-trigger-event-for-macro-s-with-dropdown-list.html
    If Intersect(Target, Range("B3")) Is Nothing Then Exit Sub
    Application.EnableEvents = False
    Call Macro1
    Call Macro2
    Application.EnableEvents = True
    End Sub

    Then make selections from the validation list in cell B3.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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