Making a Multiple Selection from a Macro in ExcelLast reviewed: September 2, 1997Article ID: Q76692 |
The information in this article applies to:
SUMMARYTo select multiple ranges on a spreadsheet from a Microsoft Excel macro, it is necessary to separate the ranges you want to select with a comma and either enclose them with a set of parentheses within the SELECT statement, or to enclose the reference in quotation marks.
MORE INFORMATIONThe SELECT statement takes two arguments. The first argument is the cell or range of cells you want to select. The second argument is the cell in the range you want to make the active cell. When using the SELECT statement in a macro to select multiple ranges, it is necessary to enclose the set of ranges in parentheses. Otherwise, the second range will be seen as the second argument to the SELECT statement, resulting in a macro error.
ExampleTo perform a multiple selection in a Microsoft Excel macro to select ranges A1:A5 and C1:C5 on the active worksheet, use the following SELECT statement in your macro:
=SELECT((!A1:A5,!C1:C5))To perform the same action using quoted references, use:
=SELECT("R1C1:R5C1,R1C3:R5C3") REFERENCES"Function Reference," version 4.0, pages 378-381 "Microsoft Excel Function Reference," version 3.0, pages 209-212 "Microsoft Excel Functions and Macros," for Windows version 2.1, pages 348-349 "Microsoft Excel for OS/2 Functions and Macros," version 2.2, pages 354-355
|
Additional query words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |