Selection based on values in a cell

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

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top