More on methods

The Offset method of the Range object has been mentioned in the previous section. It is tempting to think of Offset as a property. It isn't for if it were, it would have to store all its neighbours inside itself - that would be a waste of memory, but it can 'go and look for its neighbours' if it is told to. When you use Offset you are telling it to 'go and look for your neighbour(s)'. Hence, Offset is a method, not a property.

Objects are more complex than the base types or the user-defined types. They have both properties and methods (attributes and behaviour).

The properties are a bit like base type variables contained within the object. For example, you've been setting the .Colorlndex of a cell's .Interior to some number like 5 or 28. So: interior is an object with a property called ColorIndex which is an integer.

myCell.Interior.Colorlndex = 3

0 0

Post a comment