Defining Ranges

You can create named ranges within Excel by highlighting the selected range and clicking InsertONameODefine to display the Define Name dialog box. Type the appropriate range name in the Names in workbook field and click Add. The list box on the dialog box contains a list of all named ranges within the current workbook.

You can see which cells are part of a specific named range by highlighting the range within the list box and viewing the corresponding range displayed in the Refers To field. Keep in mind that Excel does allow you to assign multiple names to the same range.

If you no longer want to make the named range available within your workbook, you can highlight the range name and click Delete. Keep in mind that if you delete a named range, any macro that references the named range no longer works correctly.

Another method for creating a named range in Excel is to highlight the range and then click the Name box. The Name box lists a reference to the first cell in the range. To assign a name to the range, type the desired range name in the Name box.

Type Range("Salary").Select, replacing "Salary" with the name of the range.

□ Switch to Excel and run the macro.

-■ Excel highlights the named range and the Name box on the Formula bar contains the range name.

Type Range("Salary").Select, replacing "Salary" with the name of the range.

□ Switch to Excel and run the macro.

-■ Excel highlights the named range and the Name box on the Formula bar contains the range name.

0 0

Post a comment