VBA - cell reference


Posted by Alan on May 30, 2001 8:30 AM

I need to obtain the value of a cell in a fixed row, but variable column? What I am looking to do is reference a value in row a (fixed), column j (variable) in a nested for next loop.

for i = 1 to number of rows
for j = 1 to number of columns
compare number in row a, column j (validity check)
perform caluclation
next j
next i

Posted by Russell on May 30, 2001 10:18 AM

You can just use cells(i,j).value. So you might have something like:

If Cells(i, j).Value = 1 then
'Do something
End If



Posted by Alan on May 31, 2001 6:40 AM

Thanks! That is what I was looking for.