Create Variable Length String Dependent Upon Size List

A

ags5406

I want to create a string that depends on the number of items in a
list.

For example, say my list looks like the following:

(a1) baseball
(a2) football
(a3) basketball
(a4) hockey
(a5) lacrosse
(a6) soccer

The string that I want will be:

John Doe plays baseball, football, basketball, hockey, lacrosse, and
soccer.

I could just use:

string = "John Doe plays " & A1 & ", " & A2 & ", " & A3 & ", " & A4 &
", " & A5 & ", " & A6 &"."

But the trick is that I won't know ahead of time how many items are in
the list. For one guy it might be three sports in the list and for
another it might be five.

Can I somehow use for/next to create the string with different numbers
of items????

Thx in advance.
 
J

JethroUK©

whether the guy has 3 sports or 6 - your existing formula will produce right
answer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top