Selection based on values in a cell

  • Thread starter Thread starter Stewart
  • Start date Start date
S

Stewart

Cell A1 contains an integer value
Cell B1 contains a (larger) integer value
The cursor is placed at cell C1
Can anyone tell me what the code would be to select a
range in row 1 which starts at the column value in A1 and
ends at the column value in B1 and then returns the cursor
to C1?
Help would be much appreciated.
 
Sub Tester1()
Range(Rows(Range("A1")), Rows(Range("B1"))).Select
Selection.Interior.ColorIndex = 4
Range("C1").Select
End Sub

Not sure what the point of selecting the rows if if you then move the
selection back to C1.

To maintain the selection and still have the cursor in C1, both
Sub Tester2()
Union(Range(Rows(Range("A1")), _
Rows(Range("B1"))), Range("C1")).Select
Range("C1").Activate
End Sub
 
Back
Top