cells() property?

L

Linn Kubler

Hi,

I'm confused. I'm working with Excel 2003 and trying to manipulate cells on
a worksheet. Looking at the Excel 2003 VB Reference documentation I see
examples like the following:

Worksheets("Sheet1").Cells(5, 3).Font.Size = 14
Worksheets("Sheet1").Cells(1).ClearContents

Now to me that means that Cells() is an object because it has properties,
..Font.Size, and methods, .ClearContents. However, in the documentation all
I can find is a Cells property, how can this be?

What I would like to do is find a listing of all the "properties", "methods"
and "events" of the Cells property. How do I go about changing font color,
size, cell shading, borders and what-not of a cell?

Like I said, I'm a bit confused.

Thanks in advence,
Linn
 
B

Bernard Liengme

Hi Linn,
You are not the first to be confused by this!
Cells is a Property of the Range object
Range.Cells(1,1) can be shortened to Cells(1,1) but the latter still
represents a Range property.

I Googled "Excel VBA Cells" and found some site that might help you. One of
them s
http://www.anthony-vba.kefra.com/vba/vbabasic2.htm

best wishes
 
B

Bob Phillips

Cells is an object, but an object can be a property of another object. Range
can be a property of Range!
 
C

Chip Pearson

Cells is not an object type in and of itself (e.g., you can't declare
a variable of type Cells). It is simply a property of a Range object
that returns (another) Range object. As such, it doesn't have
properties of methods itself. Since it is a Range object, it has the
same properties and methods of a Range.

Any operation that can carried out on a "normal" Range can be done
with the Range returned by Cells.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
 

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