Excel: Selecting a Variable Range Through a MacroLast reviewed: November 30, 1994Article ID: Q21585 |
SUMMARYTo select a variable range of cells on a Microsoft Excel for the Macintosh version 1.0, 1.03, 1.04, 1.06, 1.5, 2.2, or 3.0 spreadsheet using a macro, use the SELECT and OFFSET functions. For example, to select the absolute cell range corresponding to integer variables defined (with the SET.NAME function) as FirstRow, FirstCol, LastRow, and LastCol, use the following formula in your macro: =SELECT(OFFSET(!A1,FirstRow-1,FirstCol-1,LastRow-FirstRow,LastCol- FirstCol)) The following formula would also work; however, the above formula is faster:
=SELECT("R"&FirstRow&"C"&FirstCol&":R"&LastRow&"C"&LastCol)For more information about selecting cells through a macro, query on the following words:
Excel and SELECT and OFFSETFor more information about using the OFFSET function with Excel for the Macintosh, see pages 163-164 in the "Microsoft Excel Function Reference" version 3.0 manual. If you are using Excel 2.2, see page 251 in the "Microsoft Excel Functions and Macros" version 2.2 manual. Note: This article also applies to Microsoft Excel for Windows and Microsoft Excel for OS/2 versions 2.1 (2.2) and 3.0 on both platforms.
|
KBCategory: kbother
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |