LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Looping data out of array


Hi all,

the code below, loops data from my userform into an array, I have
posted this on here before but am going to elaborate a little more in
this thread;


Code:
--------------------

Static Counter As Long
Static sizeofarray As Long

Counter = Counter + 1
ReDim Preserve ary(1 To 3, 1 To 3, 1 To Counter)

flag = False

For i = 1 To 3

ary(1, i, Counter) = MachineNumber
ary(2, i, Counter) = Controls("lblDTCode" & i).Caption
ary(3, i, Counter) = Controls("lblDTDuration" & i).Caption

If ary(2, i, Counter) < "" Then

sizeofarray = sizeofarray + 1
aryCount = sizeofarray

End If

flag = True

Next i

--------------------


As stated in previous post, the code above works fine, looping it back
out is the problem;


Code:
--------------------

For r = 0 To aryCount

p = 1
q = 0
Do

If ary(2, p, i) < "" Then

ActiveCell.Offset(r, 6) = ary(2, p, i)
ActiveCell.Offset(r, 7) = ary(3, p, i)

End If

p = p + 1
q = q + 1
Loop Until p = 4

Next r

--------------------


It seems I need a nested loop for 3 variables (i, r, and p) where i
loops through 1-6, r loops through 0-18 and p loops through 1-3. Anyone
out there got any clue?

I am going to stick with a 3d array btw, seems the most appropriate for
the data. Thanks all


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=508000

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write an array to a range without looping Andy Excel Worksheet Functions 3 April 27th 11 12:52 PM
Simple Array Looping Nikky Excel Programming 2 April 20th 05 10:38 PM
Array / Looping Question Matt W[_2_] Excel Programming 7 April 10th 05 07:52 PM
Error after last object in the array when looping For...each Gunnar Johansson[_3_] Excel Programming 3 December 14th 04 12:23 PM
Looping through Sheets and passing values to an Array Michael Rhein Excel Programming 2 February 13th 04 10:54 AM


All times are GMT +1. The time now is 09:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"