Named Ranges

You've probably already used Named ranges on your sheets and in formulas. You can also use them in VBA.

To refer to the range "MyRange" in Sheetl, do this: Worksheets(1).Range("MyRange")

Notice that the Name of the range is in quotes—unlike the use of Named ranges in formulas on the sheet itself. If you forget to put the Name in quotes, Excel thinks you are referring to a variable in the program, unless you are using the shortcut syntax discussed in the previous section, in which case, quotes are not used.

0 0

Post a comment