Microsoft Office Tutorials and References
In Depth Information
Explore the Excel Object Model
Chapter 11: Learning VBA Basics
Worksheet Object
You can use VBA to create new worksheets, copy, move, and delete worksheets, and more. You
can reference a specific worksheet either by using the ActiveSheet object, which represents the
worksheet that currently has the focus, or by using the Worksheets collection, which represents all
the worksheets currently open in Excel. Here are some examples:
Worksheets(1)
Worksheets(“Sheet1”)
Worksheet Properties
Property
Description
Name
Returns the name of the worksheet.
StandardHeight
Returns or sets the standard row height.
StandardWidth
Returns or sets the standard column width.
Visible
Hides or displays a worksheet.
Worksheet Methods
Method
Description
Add
Creates a new worksheet.
Copy
Copies a worksheet.
Move
Moves a worksheet.
Delete
Deletes a worksheet.
Range Object
You can use VBA to select a range, add data to a range, format a range, and more. You can
reference a specific cell by using the ActiveCell object, which represents the worksheet cell that
currently has the focus. You can also use the WorkSheet object’s Range method to specify a range
using a reference or a defined name. Here are some examples:
Worksheets(1).Range(“A1:B10”)
ActiveSheet.Range(“Expenses”)
Range Properties
Property
Description
Address
Returns the address of the range.
Count
Returns the number of cells in the range.
Value
Returns or sets the data or formula for the range.
Range Methods
Method
Description
Cut
Cuts a range to the Clipboard.
Copy
Copies a range to the Clipboard.
Clear
Clears all data and formatting from a range.
 
Search JabSto ::




Custom Search