Selecting Noncontinuous Ranges by Name in an Excel Macro

ID: Q49425


The information in this article applies to:
  • Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a, 5.0
  • Microsoft Excel for OS/2, versions 2.2, 2.21, 3.0


SUMMARY

To select more than one range in a macro, the ranges can be named and then used in a SELECT statement, as in the following sample macro:


   =ACTIVATE("Sheet2")
   =SELECT("area1,area2,area3") 


The cells on Sheet2 have been defined as follows:


   Cell Range    Defined As
   ----------    ----------

   A1 to C3      area1
   D5 to G7      area2
   A9 to G12     area3 


The first cell in the first named range is the active cell. In the above example, it is A1.

Additional query words:

Keywords :
Version : WINDOWS:2.x,3.0,4.0,4.0a,5.0; :2.2,2.21,3.0
Platform : WINDOWS
Issue type :


Last Reviewed: January 4, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.