Modifying object properties
Knowing how to refer to objects is only the first step in working with them. In this recipe, we will be learning how to modify the properties of objects. You can think of properties as attributes that describe an object. In order to use them to do something of value, you must be able to do the following:
- Read an object's properties and then modify them.
- Specify a method of action to be used with that object (more about this in the next recipe).
Getting ready
Make sure that a blank workbook is active in Excel.
How to do it…
Let's see the steps for this recipe:
- With Excel open, press Alt + F11 to activate the VBA Editor.
- In the Project window of Explorer, double-click on Sheet1 under Book1. The corresponding code window will appear:
- Type the following code:
Sub ChangeValue() Â Â Â Â Â Â Worksheets("Sheet1").Range...