Aussiebear
01-01-2022, 07:18 PM
Sub range_demo()
'declare variable
Dim lastrow As Integer
'initialize variable
lastrow = ActiveSheet.UsedRange.Rows.Count
'Use the variable in the range expression to select
Sheets("Wonders").Range("A2:C" & lastrow).Select
'colour the selected cells in green
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 5296274 'green colour
End With
End Sub
'declare variable
Dim lastrow As Integer
'initialize variable
lastrow = ActiveSheet.UsedRange.Rows.Count
'Use the variable in the range expression to select
Sheets("Wonders").Range("A2:C" & lastrow).Select
'colour the selected cells in green
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 5296274 'green colour
End With
End Sub