Microsoft Office Tutorials and References

In Depth Information

**16.1.9.3 Selection property**

The code:

Dim a As Variant

a = Application.InputBox( _

Prompt:="Enter Array", Type:=64)

Debug.Print a(3,2)

will accept the input:

A1:B6

after which
a(3,2)
will equal 56.

As a final example, if we respond to the code:

Dim a As Variant

a = Application.InputBox( Prompt:="Enter Formula", Type:=1)

Range("D1").Formula = a

with a formula, Excel does not put the formula in the cell D1 (it puts only the number), even

though 1 is a sum of 1 and 0. In other words, we shouldn't take the sum statement too literally.

16.1.9.3 Selection property

This property simply returns the currently selected object in the active window. For instance, if a

cell is selected, the property returns a Range object denoting this cell. The Selection property

returns
Nothing
if nothing is selected. Note that the property also applies to a Window object

and returns the current selection in that window.

16.1.9.4 StatusBar property (R/W String)

This useful property returns or sets the text in Excel's status bar. To return control of the status bar

to Excel, simply set this property to
False
. (Similarly, this property will return
False
if Excel

currently has control over the status bar.)

16.1.9.5 Intersect method

This method returns a Range object that represents the rectangular intersection of two or more

ranges. The syntax is:

Application.Intersect(
Arg1
,
Arg2
, ...)

where
Arg1
,
Arg2
, . . . are the Range objects whose ranges we wish to intersect. At least two

Range
objects must be specified. For instance, the following line selects the intersection, which is

the range B2:D5: