Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through each element of an array
Hello All,
Is there better code for looping through each element in an array than For pintIndex = 0 to 7 'do stuff in pstrArrayName(pintIndex) Next pintIndex I was hoping for something like a For...Each statement. For each (element) in pstrArrayName 'do stuff Next (element) Thanks for any help anyone can provide, Conan Kelly |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through each element of an array
Conan Kelly
maybe something like: For pintIndex = lbound(pstrArrayName) to ubound(pstrArrayName) 'do stuff in pstrArrayName(pintIndex) Next pintIndex assuming the number of elements varies (and that's what you are trying to overcome) Regards Trevor "Conan Kelly" <CTBarbarin at msn dot com wrote in message ... Hello All, Is there better code for looping through each element in an array than For pintIndex = 0 to 7 'do stuff in pstrArrayName(pintIndex) Next pintIndex I was hoping for something like a For...Each statement. For each (element) in pstrArrayName 'do stuff Next (element) Thanks for any help anyone can provide, Conan Kelly |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through each element of an array
Thanks for the info, Trevor.
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through each element of an array
As you hoped:
For Each Elem in pstrArrayName Debug.print Elem Next Alan Beban Conan Kelly wrote: Hello All, Is there better code for looping through each element in an array than For pintIndex = 0 to 7 'do stuff in pstrArrayName(pintIndex) Next pintIndex I was hoping for something like a For...Each statement. For each (element) in pstrArrayName 'do stuff Next (element) Thanks for any help anyone can provide, Conan Kelly |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Permutations of an array element < to a value | Excel Worksheet Functions | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
Getting Value of Array element in Immediate Window | Excel Programming | |||
Array element | Excel Programming |