Microsoft Excel Training Videos

Referring to Excel Cells by Using a Range Object in a macro in Microsofft Excel


If you set an object variable to a Range object, you can easily manipulate the Excel range by using the variable name in Microsoft Excel.
The following procedure creates the object variable myRange and then assigns the variable to Excel range A1:D5 on Sheet1 in the active Excel workbook. Subsequent statements modify properties of the Excel range by substituting the variable name for the range object.
Sub Random()
Dim myRange As Range
Set myRange = Worksheets("Sheet1").Range("A1:D5")
myRange.Formula = "=RAND()"
myRange.Font.Bold = True
End Sub
The training video below shows how to create and execute the Excel macro.




Custom Search

More resources on this Excel topic

Referring to ranges directly

Microsoft Excel Training Videos