Using the Range Property to Refer to Groups of Cells
Sub UsingRange()
Dim ws As Worksheet
Dim rg As Range
Set ws = ThisWorkbook.Worksheets(1)
Set rg = ws.Range(ws.Cells(1, 1), ws.Cells(10, 10))
rg.Value = 1
Set rg = ws.Range("D4", "E5")
rg.Font.Bold = True
ws.Range("A1:B2").HorizontalAlignment = xlLeft
Set rg = Nothing
Set ws = Nothing
End Sub
Related examples in the same category