|
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
|