Right now i have a program that that collect 2 columns of data out of excel and puts them into an array. The way i am doing this is as follows
Range("B1"
.Select
For I = 0 To 16000
pH(I, 0) = ActiveCell
pH(I, 2) = ActiveCell.Offset(0, 1)
ActiveCell.Offset(1, 0).Select
Next I
Now this works fine but it has to run thru all 16 thousand rows. So it takes about 45 seconds. The rest of the program runs thru the array, in VBA, and can do it in about 2 second(if that). I was wondering if there is any way to do something as follows.
var1 = "B1"
var2 = "B2"
For I = 0 To 16000
pH(I, 0) = Range(var1)
pH(I, 2) = Range(var2)
var1 = var1 + 1
var2 = var2 + 2
Next I
Hopefully by doing this it would not have to scroll thru all 16,000 rows.
Range("B1"
For I = 0 To 16000
pH(I, 0) = ActiveCell
pH(I, 2) = ActiveCell.Offset(0, 1)
ActiveCell.Offset(1, 0).Select
Next I
Now this works fine but it has to run thru all 16 thousand rows. So it takes about 45 seconds. The rest of the program runs thru the array, in VBA, and can do it in about 2 second(if that). I was wondering if there is any way to do something as follows.
var1 = "B1"
var2 = "B2"
For I = 0 To 16000
pH(I, 0) = Range(var1)
pH(I, 2) = Range(var2)
var1 = var1 + 1
var2 = var2 + 2
Next I
Hopefully by doing this it would not have to scroll thru all 16,000 rows.