How to: Refer to Named Ranges
|Excel Developer Reference|
Ranges are easier to identify by name than by A1 notation. To name a selected range, click the name box at the left end of the formula bar, type a name, and then press ENTER.
Referring to a Named Range
The following example refers to the range named "MyRange" in the workbook named "MyBook.xls."
The following example refers to the worksheet-specific range named "Sheet1!Sales" in the workbook named "Report.xls."
To select a named range, use the GoTo method, which activates the workbook and the worksheet and then selects the range.
The following example shows how the same procedure would be written for the active workbook.
Looping Through Cells in a Named Range
The following example loops through each cell in a named range by using a For Each...Next loop. If the value of any cell in the range exceeds the value of
limit, the cell color is changed to yellow.