Refer to cells by using the shortcut notation in a macro |
|
You can refer to cells by using shortcut notation like the A1 reference style or a named range within brackets as a shortcut for the Range property. You don't have to type the word "Range" or use quotation marks, as shown in the following examples. Sub ClearRange() Worksheets("Sheet1").[A1:B5].ClearContents End Sub Sub SetValue() [MyRange].Value = 90 End Sub In the following Excel training video, two macros demonstrate how to clear the contents of an Excel range and how to fill data in Excel cells in a named range. |
|