Methods and Properties

Methods and Properties

Each object contains its own methods and properties.

A Property represents a built-in or user-defined characteristic of the object.  A method is an action that you perform with an object.  Below are examples of a method and a property for the Workbook Object:


Close method close the active workbook


Count property returns the number of workbooks that are currently opened
Some objects have default properties. For example, Range’s default property is Value.
The following yields the same outcome.

Range(“A1”) = 1    and     Range(“A1”).Value = 1
Here are examples on how to set and to get a Range property value:
The following sets the value of range A1 or Cells(1,1)  as “2005”.  It actually prints “2005” on A1.

Range(“A1”).Value = 2005
The following gets the value from range A1 or Cells(1,1).

X = Range(“A1”).Value
Method can be used with or without argument(s).  The following two examples demostrate this behavior.

Methods That Take No Arguments:

Methods That Take Arguments:

Worksheets(“Sheet1”).Range(“A1:A10”).Sort _
Worksheets(“Sheet1”).Range(“A1”) is the Key (or column) to sort by.

March 4, 2012

0 Responses on Methods and Properties"

Leave a Message

© copyright www.excelcrazy.com. All rights reserved. Design and Development by www.creativebrainweb.com