P pcw Feb 25, 2004 #1 I have often seen the following ... Cells(1,1) What does it mean? Is it referencing first row and column?
I have often seen the following ... Cells(1,1) What does it mean? Is it referencing first row and column?
J JE McGimpsey Feb 25, 2004 #2 It means the first row and first column of its parent object. By default, the parent object is the Activesheet, so Cells(1, 1).Value = 1 will place the value 1 in the ActiveSheet's cell A1. Similarly, Range("J10:K100").Cells(1, 1) = 1 would place 1 in the cell in the first row and first column of the range J10:K100 of the ActiveSheet, or cell J10. See the entry for Range Object in XL/VBA Help for more.
It means the first row and first column of its parent object. By default, the parent object is the Activesheet, so Cells(1, 1).Value = 1 will place the value 1 in the ActiveSheet's cell A1. Similarly, Range("J10:K100").Cells(1, 1) = 1 would place 1 in the cell in the first row and first column of the range J10:K100 of the ActiveSheet, or cell J10. See the entry for Range Object in XL/VBA Help for more.
A Alan Beban Feb 25, 2004 #3 JE said: . . . Similarly, Range("J10:K100").Cells(1, 1) = 1 would place 1 in the cell in the first row and first column of the range J10:K100 of the ActiveSheet, or cell J10. . . . Click to expand... Although the .Cells is superfluous and slows things down as contrasted with Range("J10:K100")(1, 1) = 1 Alan Beban
JE said: . . . Similarly, Range("J10:K100").Cells(1, 1) = 1 would place 1 in the cell in the first row and first column of the range J10:K100 of the ActiveSheet, or cell J10. . . . Click to expand... Although the .Cells is superfluous and slows things down as contrasted with Range("J10:K100")(1, 1) = 1 Alan Beban
J JE McGimpsey Feb 25, 2004 #4 Alan Beban said: Although the .Cells is superfluous and slows things down as contrasted with Range("J10:K100")(1, 1) = 1 Click to expand... True, but the OP wanted to know about .Cells(1, 1), not .Item(1, 1)
Alan Beban said: Although the .Cells is superfluous and slows things down as contrasted with Range("J10:K100")(1, 1) = 1 Click to expand... True, but the OP wanted to know about .Cells(1, 1), not .Item(1, 1)