View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
colofnature[_43_] colofnature[_43_] is offline
external usenet poster
 
Posts: 1
Default Getting values in row and advancing


To read the values in A-D into four variables to use immediately:

for i = 1 to intersect(activesheet.usedrange,[a:d]).rows.count
A_variable = cells(i,1).value
B_variable = cells(i,2).value
C_variable = cells(i,3).value
D_variable = cells(i,4).value
' Perform your calculation here
next


To read them into an array to use later:

Dim varrayCellValues as Variant
data_count = intersect(activesheet.usedrange,[a:d]).rows.count
ReDim varrayCellValues(1 to 4, 1 to data_count)
for i = 1 to 4 ' refers to the row
for j = 1 to data_count ' refers to the column
varrayCellValues(i, j) = cells(j, i).value
next: next


Hope that helps
Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=548618