Microsoft Office Tutorials and References
In Depth Information
End Function
The Set keyword
An important concept in VBA is the ability to create a new Range object and assign it to a variable — more
specifically, an object variable. You do so by using the Set keyword. The following statement creates an object
variable named MyRange:
Set MyRange = Range(“A1:A10”)
After the statement executes, you can use the MyRange variable in your code in place of the actual range refer-
ence. Examples in subsequent sections help to clarify this concept.
Creating a Range object is not the same as creating a named range. In other words, you
can't use the name of a Range object in your worksheet formulas.
The Intersect function
The Intersect function returns a range that consists of the intersection of two other ranges. For example, con-
sider the two ranges selected in Figure 25-2. These ranges, D3:D10 and B5:F5, contain one cell in common
(D5). In other words, D5 is the intersection of D3:D10 and B5:F5.
Search JabSto ::

Custom Search