mardi 1 décembre 2015

Run a macro from Data Validation List selection

I want to be able to run one of 3 macros I created (Cultivator1, TowBehind1 or TwoBetween1) based on one of 3 corresponding selections from my drop down list in T7. I'm using the following code located in ThisWorkbook. It runs the first macro okay but does not run the next two when the appropriate list selection is made. The ElseIf lines don't seem to work. What am I doing wrong?

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    If Not Intersect(Target, Range("T7")) Is Nothing Then
    On Error GoTo FallThrough
    Application.EnableEvents = False
    Application.ScreenUpdating = False

    If Range("T7").Value = "CULTIVATOR" Then _
        Call Cultivator1
    ElseIf Range("T7").Value = "AIR SEEDER (NH3 TOW BEHIND)" Then _
        Call TowBehind1
    ElseIf Range("T7").Value = "AIR SEEDER (NH3 TOW BETWEEN)" Then _
        Call TowBetween1
    End If

FallThrough:
    Application.EnableEvents = True
    Application.ScreenUpdating = True
End Sub

Aucun commentaire:

Enregistrer un commentaire