You can also install it like this:
Set R1 = Range("A7","A" & LR)
What you did was that you mix Range syntax. The following is the general syntax for Range:
Using : to determine Range :
Range("A1:A" & LR) '~~> where LR holds the last row number
Using , to determine Range :
Range("A1","A" & LR)
Using the Cells property:
Range(Cells(1, "A"),Cells(LR, "A")) Range(Cells(1, 1),Cells(LR, 1)) '~~> another way
Using the Range property:
Range(Range("A1"),Range("A" & LR)) Range(Range("A1").address & ":" & Range("A" & LR).Address) '~~> yet another complicated way
All syntax above evaluates to: $A$1:$A$(LR)
Each has certain advantages and benefits.
Use the most appropriate syntax for you.
Additionally:
This one uses the Intersect Function :
Set R1 = Intersect(Columns("A:A"),Rows("1:" & LR))
source share