|
-
Mar 23rd, 2006, 03:06 PM
#1
Thread Starter
Junior Member
Looping through columns and arrays
Hi all, new to vb scripting and trying to get work with an excel document and loop through an column on data and add it to an array
VB Code:
Dim i
i = 0
Dim bv
Dim arrBan()
Dim CellValue
bv = 3
'check the length of the column to create an array of good length
Do Until objXL.Cells(bv,15).value = ""
arrBan(i) = objXL.Cells(bv,15).value
i = i + 1
bv = bv + 1
loop
from this i get a subscript out of range error, the column can be any length so i cant set a value to the array but a dynamic array should work fine right?
also to see if my thought proccess is right, overall what i am trying to do is compare 2 excel docs to a third, based on the numbers in this column, what i was going to do was get the get the numbers from the 2 sheets and compare them to the third. long proccess i know but i am slowly working on it any advice would be greatly apprecaited
EDIT: fixed the looping issue the array had to be set to a value, now a better question is there a way to dynamically set a array length based on a number of columns
Last edited by fizban2; Mar 23rd, 2006 at 03:31 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|