Caleeco
Well-known Member
- Joined
- Jan 9, 2016
- Messages
- 980
- Office Version
- 2010
- Platform
- Windows
Hello,
I'm struggling with setting up a 2D array, and populating it with an loop
My sheet is set out as follows:
Excel 2012
<tbody>
[TD="align: center"]7[/TD]
[TD="bgcolor: #EAF3FA, align: right"]08[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]08[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]08[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]08[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]08[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]30[/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]00[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]00[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: center"]9[/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA"]Min[/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA"]Min[/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA"]Min[/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA"]Min[/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA"]Min[/TD]
[TD="align: center"]10[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: center"]11[/TD]
[TD="bgcolor: #EAF3FA, align: right"]17[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]00[/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]17[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]00[/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]17[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]00[/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]17[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]00[/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]17[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]30[/TD]
</tbody>
[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]K9[/TH]
[TD="align: left"]=(TIMEVALUE(K10&":"&M10)-TIMEVALUE(K8&":"&M8))*24*60[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]P9[/TH]
[TD="align: left"]=(TIMEVALUE(P10&":"&R10)-TIMEVALUE(P8&":"&R8))*24*60[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]U9[/TH]
[TD="align: left"]=(TIMEVALUE(U10&":"&W10)-TIMEVALUE(U8&":"&W8))*24*60[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]Z9[/TH]
[TD="align: left"]=(TIMEVALUE(Z10&":"&AB10)-TIMEVALUE(Z8&":"&AB8))*24*60[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]AE9[/TH]
[TD="align: left"]=(TIMEVALUE(AE10&":"&AG10)-TIMEVALUE(AE8&":"&AG8))*24*60[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
What I wish to do, is capture all the entered Hours and minutes in a 2D array. Row 9 needs to be ignored. Eg. the first columns of hours and minutes can be captured as
and then the second column of hours and minutes would be
an so fourth until the 5th column. Is there a way to setup an efficient loop? Open to changing array structure, eg:
The intent is to capture the data, paste it to another sheet, and then be able to recall the times and paste in their respective locations.
Any help would be appreciated
Thanks
Caleeco
I'm struggling with setting up a 2D array, and populating it with an loop
My sheet is set out as follows:
Excel 2012
K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | AA | AB | AC | AD | AE | AF | AG | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
00 | 00 | 00 | |||||||||||||||||||||
30 | 30 | 30 | 30 | 30 | |||||||||||||||||||
<tbody>
[TD="align: center"]7[/TD]
[TD="bgcolor: #EAF3FA, align: right"]08[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]08[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]08[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]08[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]08[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]30[/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]00[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]00[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: center"]9[/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA"]Min[/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA"]Min[/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA"]Min[/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA"]Min[/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: center"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]30[/TD]
[TD="bgcolor: #EAF3FA, align: right"][/TD]
[TD="bgcolor: #EAF3FA"]Min[/TD]
[TD="align: center"]10[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: right"]12[/TD]
[TD="align: center"]:[/TD]
[TD="align: center"]11[/TD]
[TD="bgcolor: #EAF3FA, align: right"]17[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]00[/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]17[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]00[/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]17[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]00[/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]17[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]00[/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA"][/TD]
[TD="bgcolor: #EAF3FA, align: right"]17[/TD]
[TD="bgcolor: #EAF3FA, align: center"]:[/TD]
[TD="bgcolor: #EAF3FA"]30[/TD]
</tbody>
Timesheet
[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]K9[/TH]
[TD="align: left"]=(TIMEVALUE(K10&":"&M10)-TIMEVALUE(K8&":"&M8))*24*60[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]P9[/TH]
[TD="align: left"]=(TIMEVALUE(P10&":"&R10)-TIMEVALUE(P8&":"&R8))*24*60[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]U9[/TH]
[TD="align: left"]=(TIMEVALUE(U10&":"&W10)-TIMEVALUE(U8&":"&W8))*24*60[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]Z9[/TH]
[TD="align: left"]=(TIMEVALUE(Z10&":"&AB10)-TIMEVALUE(Z8&":"&AB8))*24*60[/TD]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]AE9[/TH]
[TD="align: left"]=(TIMEVALUE(AE10&":"&AG10)-TIMEVALUE(AE8&":"&AG8))*24*60[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
What I wish to do, is capture all the entered Hours and minutes in a 2D array. Row 9 needs to be ignored. Eg. the first columns of hours and minutes can be captured as
Code:
myarr(1, 1) = Cells(7, 11)
myarr(2, 1) = Cells(7, 13)
myarr(3, 1) = Cells(8, 11)
myarr(4, 1) = Cells(8, 13)
'
myarr(5, 1) = Cells(10, 11)
myarr(6, 1) = Cells(10, 13)
myarr(7, 1) = Cells(11, 11)
myarr(8, 1) = Cells(11, 13)
and then the second column of hours and minutes would be
Code:
myarr(1, 1) = Cells(7, 16)
myarr(2, 1) = Cells(7, 18)
myarr(3, 1) = Cells(8, 16)
myarr(4, 1) = Cells(8, 18)
'
myarr(5, 1) = Cells(10, 16)
myarr(6, 1) = Cells(10, 18)
myarr(7, 1) = Cells(11, 16)
myarr(8, 1) = Cells(11, 18)
an so fourth until the 5th column. Is there a way to setup an efficient loop? Open to changing array structure, eg:
Code:
myarr(1 to 40) as string
The intent is to capture the data, paste it to another sheet, and then be able to recall the times and paste in their respective locations.
Any help would be appreciated
Thanks
Caleeco
Last edited: