Cells(1,1)

P

pcw

I have often seen the following ... Cells(1,1)

What does it mean? Is it referencing first row and column?
 
J

JE McGimpsey

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

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. . . .

Although the .Cells is superfluous and slows things down as contrasted with

Range("J10:K100")(1, 1) = 1

Alan Beban
 
J

JE McGimpsey

Alan Beban said:
Although the .Cells is superfluous and slows things down as contrasted with

Range("J10:K100")(1, 1) = 1

True, but the OP wanted to know about .Cells(1, 1), not .Item(1, 1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top