Loop through drop down list and then call other macros

DPhilip

New Member
Joined
Jan 12, 2016
Messages
27
Good Morning. Anyone point out to me how to loop through a drop down list and then call another macro?

Ex. Drop down list:
Apple
Orange
Peach
Mango
Plum

I want it to go to apple first, run a macro I already use have then move to Orange and run the macro again until i get to plum and stop.

Right now I go to Apple then run the macro, then manually go to Orange, run the macro.. I have about 200 on my drop down list and this will save a lot of time.

Thanks in advance.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
How did you create/populate the dropdown?
 
Upvote 0
If the Validated cell is Sheet1!A1, you might use


Code:
Dim oneThing as Variant
Dim ListOfThings as Variant

With Sheets("Sheet1").Range("A1").Validation
    If .Formula1 Like "=*" Then
        ListOfThings = Evaluate(.Formula1)
    Else
        ListOfThings = Split(.Formula1, ",")
    End If

    For Each oneThing in ListOfThings
        .Value = oneThing
        Call otherMacro
    Next oneThing
End With
 
Upvote 0
Thank you so much but I am getting an Run Time Error 450 - "Wrong number of arguments or invalid property assignments" I presssed F8 to see the error and its the "Call Other Macro" part.

If the Validated cell is Sheet1!A1, you might use


Code:
Dim oneThing as Variant
Dim ListOfThings as Variant

With Sheets("Sheet1").Range("A1").Validation
    If .Formula1 Like "=*" Then
        ListOfThings = Evaluate(.Formula1)
    Else
        ListOfThings = Split(.Formula1, ",")
    End If

    For Each oneThing in ListOfThings
        .Value = oneThing
        Call otherMacro
    Next oneThing
End With
 
Upvote 0
The OP asks to loop through the list and call other macros. You would substitute the actual name of the other macro.
 
Upvote 0
Can you post the macro(s) you are trying to call?
 
Upvote 0
Well, I usually run this macro which calls all these macros..

Sub RunAllMacros()

HaulRevenue
FRejects
FilterClockShark
Differential
Splits
LegOne
LegTwo
PaymentSummary
SaveSheetsAsPDF
End Sub
 
Upvote 0
Have you replaced this line of code, from Mike's code in post #4,
Code:
Call otherMacro
with this?
Code:
Call RunAllMacros
 
Upvote 0

Forum statistics

Threads
1,223,445
Messages
6,172,176
Members
452,446
Latest member
walkman99

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top