Microsoft Excel Training Videos

Referring to Named Ranges in a macro

Referring to named ranges: Ranges are easy to identify by name in Microsoft Excel. To name a selected Excel range, click the name box at the left end of the formula bar, type a name, and then press ENTER.
The following example refers to the range named "MyRange" in the Excel workbook named "package.xls."

Sub FormatRange()
Range("package.xls!MyRange").Font.Italic = True
End Sub
To select an Excel named range, use the GoTo method in Microsoft Excel, which activates the Excel workbook and the spreadsheet and then selects the range.
Sub ClearRange()
Application.Goto
Reference:="package.xls!MyRange"
Selection.ClearContents
End Sub

The following example shows how the same procedure would be written for the active Excel workbook.
Sub ClearRange()
Application.Goto Reference:="MyRange"
Selection.ClearContents
End Sub
The macro in the Excel training video demonstrates how to format an Excel range called 'Myrange'



Further Links
Named ranges
Referring to named ranges