re write

R

RobcPettit

Hi, Others today have already kindly helped with my queries today, for
which Im grateful. I though Id post this to see if it helps with the
questions I m asking. Below is my attempt, xsum are normal variables
and runner are static. I was looking at this and seeing if I could use
a for/next with it, as I wish to add many more runners, and with prev
help Ive used Dim xsum(1 to 4) which is ok, but Im struggling with the
static variables.
For y = UBound(Runner1) - 20 To UBound(Runner1)
x20sum1 = x20sum1 + Runner1(y)
x20sum2 = x20sum2 + Runner2(y)
x20sum3 = x20sum3 + Runner3(y)
x20sum4 = x20sum4 + Runner4(y)

Next y

This is what Ive attempted but doesnt work. I though diefine the
runners individually.
For i = 1 to 4
For y = UBound(Runner(i)) - 20 To UBound(Runner(i))
x20sum(i) = x20sum(i) + Runner(i)(y)
Next y
Next i

I cant get past '+ Runner(i)(y)' which is a syntax error. Any ideas
how to rewrite this.

Regards Robert
 
B

Bob Phillips

Try

Dim Runner(1 To 20, 1 To 4)

For y = LBound(Runner, 1) To UBound(Runner, 1)
x20sum1 = x20sum1 + Runner1(y, 1)
x20sum2 = x20sum2 + Runner2(y, 2)
x20sum3 = x20sum3 + Runner3(y, 3)
x20sum4 = x20sum4 + Runner4(y, 4)
Next y

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
R

RobcPettit

Thanks Bob, that great. Ive replyed to my other post. Thanks for taking
the time. Its been a great help today.
Regards Robert
 

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