Microsoft Office Tutorials and References
In Depth Information
The following Application object properties are the most used:
You can get information on every element of the Excel object model in the Visual Basic Editor help system
by typing object model in the Ask A Question box and viewing the Microsoft Excel Object Model help topic.
The short list of Application properties contains the most common objects that are used
within Excel. Most have been exposed directly by the Excel programming team so that an
explicit reference to the application object isn’t needed. These properties are described in the
following sections in alphabetical order.
ActiveCell Property
The ActiveCell property is exactly what its name implies: a reference to the currently active
cell on the active work sheet on the active workbook. When called, the ActiveCell property
returns a Range object that can be used to set the value or formula of the cell along with any
formatting changes you might want to make (font style, borders, format of numbers, and
so on).
The following example uses the CellBorder procedure to examine the value of a cell and
change the border around the cell if it has a value between 500 and 1000. The ApplyBorders
procedure loops through all of the specified data cells within the Y2001ByMonth.xls
workbook, shown in Figure 6-2, and then calls the CellBorder procedure for each cell.
Sub ApplyBorders()
Dim MyCell As Range
For Each MyCell In _
If ActiveCell > 500 And ActiveCell < 1000 Then
With ActiveCell.Borders
.Weight = xlThick
.Color = vbBlue
End With
End If
Next MyCell
End Sub
Search JabSto ::

Custom Search