This documentation is archived and is not being maintained.

Application.Union Method

Office 2007
Returns the union of two or more ranges.

Syntax

expression.Union(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression   A variable that represents an Application object.

Parameters

NameRequired/OptionalData TypeDescription
Arg1RequiredRangeAt least two Range objects must be specified.
Arg2RequiredRangeAt least two Range objects must be specified.
Arg3OptionalVariantAt least two Range objects must be specified.
Arg4OptionalVariantAt least two Range objects must be specified.
Arg5OptionalVariantAt least two Range objects must be specified.
Arg6OptionalVariantAt least two Range objects must be specified.
Arg7OptionalVariantAt least two Range objects must be specified.
Arg8OptionalVariantAt least two Range objects must be specified.
Arg9OptionalVariantAt least two Range objects must be specified.
Arg10OptionalVariantAt least two Range objects must be specified.
Arg11OptionalVariantAt least two Range objects must be specified.
Arg12OptionalVariantAt least two Range objects must be specified.
Arg13OptionalVariantAt least two Range objects must be specified.
Arg14OptionalVariantAt least two Range objects must be specified.
Arg15OptionalVariantAt least two Range objects must be specified.
Arg16OptionalVariantAt least two Range objects must be specified.
Arg17OptionalVariantAt least two Range objects must be specified.
Arg18OptionalVariantAt least two Range objects must be specified.
Arg19OptionalVariantAt least two Range objects must be specified.
Arg20OptionalVariantAt least two Range objects must be specified.
Arg21OptionalVariantAt least two Range objects must be specified.
Arg22OptionalVariantAt least two Range objects must be specified.
Arg23OptionalVariantAt least two Range objects must be specified.
Arg24OptionalVariantAt least two Range objects must be specified.
Arg25OptionalVariantAt least two Range objects must be specified.
Arg26OptionalVariantAt least two Range objects must be specified.
Arg27OptionalVariantAt least two Range objects must be specified.
Arg28OptionalVariantAt least two Range objects must be specified.
Arg29OptionalVariantAt least two Range objects must be specified.
Arg30OptionalVariantAt least two Range objects must be specified.

Return Value
Range

Example

This example fills the union of two named ranges, Range1 and Range2, with the formula =RAND().

Visual Basic for Applications
Worksheets("Sheet1").Activate
Set bigRange = Application.Union(Range("Range1"), Range("Range2"))
bigRange.Formula = "=RAND()"



Show: