Refer to Named Ranges in Excel macro |
|||
|
Refer to Named Ranges in Excel
macro. This
makes working in Microsoft Excel quite convenient and productive.
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. |
|||
|
|
|||
|
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 and finally clears or deletes the contents
of the range "MyRange". The following example shows how the same procedure would
be
written for the active Excel workbook. NOTE:
Macro actions cannot be undone. Of course you can use a macro to define a named range and then access it to perform an action on it like clearing the contents as shown below: Sub NamedRange()Dim Range1 As Range Set Range1 = Sheets("Sheet1").Range("F4:F10") ActiveWorkbook.Names.Add Name:="MyRange", RefersTo:=Range1 Application.Goto Reference:="MyRange" Selection.Font.Bold=True End Sub Watch the Excel Training video below to see the macro
in action: |
|||
|
|||