Link to home
Start Free TrialLog in
Avatar of bfuchs
bfuchsFlag for United States of America

asked on

looping syntax

Hi Experts,

How do I use a loop in VBA for the following
I would like to use the same logic of code for different values
Something like

For MyVar = "A","B","C"
s=MyVar
Next
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

If you can use an array for your variable, you could do this....

Dim MyVar, i As Integer
MyVar = Array("A", "B", "C")
For i = 0 To UBound(MyVar)
    MsgBox MyVar(i)
Next

Open in new window

Avatar of bfuchs

ASKER

Hi,
What is the difference between array function and split?
ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bfuchs

ASKER

Thank You!