Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Access Array by index
I wanted to accumulate the value in my array.
ARR as Variant I need to check that does array have value before add to my accumulator. I tried to access using ARR[i] and ARR(i), but no of them works. Any information is great appreciated, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Access Array by index
Sub ABC()
Dim Arr As Variant ReDim Arr(1 To 10) For i = 1 To 10 Arr(i) = Int(Rnd() * 100 + 1) Next For j = 1 To 10 msg = msg & Arr(j) & IIf(j < 10, ", ", "") Next MsgBox msg End Sub addresses an array using an index. -- Regards, Tom Ogivly "Souris" wrote in message ...[i] I wanted to accumulate the value in my array. ARR as Variant I need to check that does array have value before add to my accumulator. I tried to access using ARR and ARR(i), but no of them works. Any information is great appreciated, |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Access Array by index
dim ARR as variant
dim k as integer dim i as integer ReDim ARR(1 To k) For i = 1 To k If ARR(i).Value Is Empty Then ARR(i).Value = 0 Next i I wanted to fill 0 if the index of array is null or empty. It seems that above code didi not work. Can you please tell me where I was wrong? Thanks millions, "Tom Ogilvy" wrote: [i] Sub ABC() Dim Arr As Variant ReDim Arr(1 To 10) For i = 1 To 10 Arr(i) = Int(Rnd() * 100 + 1) Next For j = 1 To 10 msg = msg & Arr(j) & IIf(j < 10, ", ", "") Next MsgBox msg End Sub addresses an array using an index. -- Regards, Tom Ogivly "Souris" wrote in message ... I wanted to accumulate the value in my array. ARR as Variant I need to check that does array have value before add to my accumulator. I tried to access using ARR and ARR(i), but no of them works. Any information is great appreciated, |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Access Array by index
Souris wrote:
dim ARR as variant dim k as integer dim i as integer ReDim ARR(1 To k) For i = 1 To k If ARR(i).Value Is Empty Then ARR(i).Value = 0 Next i I wanted to fill 0 if the index of array is null or empty. It seems that above code didi not work. Can you please tell me where I was wrong? Thanks millions, If IsEmpty(ARR(i)) Then ARR(i) = 0 Alan Beban |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help in finding Value in Index Array | Excel Discussion (Misc queries) | |||
Index array question | Excel Worksheet Functions | |||
Vlookup with col index no. array | Excel Discussion (Misc queries) | |||
Using Array Index function in a sub | Excel Programming | |||
Index of Minimum value in array | Excel Programming |