+ Reply to Thread
Results 1 to 2 of 2

run macro based on combination of values from 2 dropdown lists

  1. #1
    Registered User
    Join Date
    09-10-2012
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    2

    Smile run macro based on combination of values from 2 dropdown lists

    hi! i'm a new member of this forum and i would just like to ask for help in running an excel macro using vba (i'm also a beginner in vba).
    I've read in one of the threads here how to run a macro from a dropdown list (data validation)
    However, what if i have 2 dropdown lists? and i want to run a macro based on the combination of values in the
    2 lists? How do I go about it? Help is very much appreciated. Thanks.

  2. #2
    Registered User
    Join Date
    09-10-2012
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: run macro based on combination of values from 2 dropdown lists

    My base code was the vba code from Leith Ross below. How can I modify this to 2 dropdown lists?


    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim Addx As String
    Dim Rng As Range

    Addx = Target.Validation.Formula1
    Set Rng = Range(Right(Addx, Len(Addx) - 1))

    If Target.Address = "$E$1" Then
    Select Case Target.Value
    Case Is = Rng.Cells(1, 1) 'First Drop Down Item
    Call MacroA
    Case Is = Rng.Cells(2, 1) 'Second Drop Down Item
    Call MacroB
    Case Is = Rng.Cells(3, 1) 'Third Drop Down Item
    Call MacroC
    End Select
    End If

    End Sub

+ 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