Thread: Array Help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Array Help

Do you mean get a running total:

tot = 0
j = i
Do
Cells(j, 3).Select
If ActiveCell.Value < "" Then

maxArray = maxArray + 1
ReDim Preserve Arry(1 To 4, 1 To maxArray)

Arry(1, maxArray) = ActiveCell.Value
Arry(2, maxArray) = ActiveCell.Offset(0, 1).Value
Arry(3, maxArray) = Right(ActiveCell.Offset(0, 2).Value, 6)
Arry(4, maxArray) = Val(ActiveCell.Offset(0, 8).Value / 1000)
if arry(1,maxArray) = arry(2,maxArray) and _
arry(2,maxArray) = arry(3,maxArray) then
tot = tot + arry(4,maxArray)
end if
End If

--
Regards,
Tom Ogilvy


"gti_jobert" wrote:


Hi all,

I have created a 2-d array that stored info;


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

j = i
Do
Cells(j, 3).Select
If ActiveCell.Value < "" Then

maxArray = maxArray + 1
ReDim Preserve Arry(1 To 4, 1 To maxArray)

Arry(1, maxArray) = ActiveCell.Value
Arry(2, maxArray) = ActiveCell.Offset(0, 1).Value
Arry(3, maxArray) = Right(ActiveCell.Offset(0, 2).Value, 6)
Arry(4, maxArray) = Val(ActiveCell.Offset(0, 8).Value / 1000)

End If

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


My question to you is.....if Arry(1, maxArray) and Arry(2, maxArray)
and Arry(3, maxArray) are the same then I want to group them and total
the Arry(4, maxArray) value.

Would the array first have to be sorted first and then grouped? Any
advice welcome!

TIA


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