set variable as it loops over array

# Thread: set variable as it loops over array

1. Junior Member
Join Date
Dec 1969
Posts
24

## set variable as it loops over array

If I have an array where<BR>dim arrDualArray(4,2)<BR>arrDualArray(0,0) = ""<BR>arrDualArray(0,1) = ""<BR>arrDualArray(0,2) = ""<BR>...<BR><BR>For i = LBound(arrDualArray) to UBound(arrDualArray)<BR> var1 = CDate(arrDualArray(i, 0))<BR> var2 = CDate(arrDualArray(i, 1))<BR> <BR> How do I set the following as it goes through the loop?<BR> x(n) = DateDiff("d", var2, var1)<BR> ...<BR> x1 =<BR> x2 = <BR> x3 = <BR>Next<BR><BR>I hope this is enough to explain what I&#039;m trying to do.

2. Senior Member
Join Date
Dec 1969
Posts
11,334

## It's not enough

What is x?<BR><BR>Just make x an array and increment it with the variable i.

3. Junior Member
Join Date
Dec 1969
Posts
24

## RE: It's not enough

X is just another variable. I guess var3 would have made more since, but as the loop is run ...<BR><BR>var3_1 = DateDiff("d", var2, var1)<BR>then the next time through<BR>var3_2 = DateDiff("d", var2, var1)<BR>next<BR>var3_3 = DateDiff("d", var2, var1)<BR>etc...<BR><BR>the DateDiff("d", var2, var1) should be set to a new variable every time through, preferrably with a number.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•