PDA

View Full Version : Solved: Referencing using a number for column



gscarter
07-28-2008, 06:00 AM
Hi,

If i have an integer J, which is my column reference and i want to highlight/select range A1 to (integer)J4, how do i go about referencing J as a column.



J = 8

Range("A1:" & J & "4").Select

Above is what im trying to do, but obviously doesnt work.

Ive also tried:



J = 8

Range("A1:" & Columns(J) & "4").Select

and:



J = 8

Range("A1:" & Cells(4, J)).Select

But i just cant seem to find a method that works.

Any help is appreciated.

Thanks
gary

Bob Phillips
07-28-2008, 06:12 AM
Range("A1").Resize(4, J).Select

Bob Phillips
07-28-2008, 06:15 AM
Another



Range(Range("A1"), Cells(4, J)).Select

gscarter
07-28-2008, 06:17 AM
Range("A1").Resize(4, J).Select


Thanks for that, id have never discovered that.

Gary

gscarter
07-28-2008, 06:40 AM
Another



Range(Range("A1"), Cells(4, J)).Select


How about if i wish to just reference the value in (integer)J4?

ive tried;



.Range(Cells(4, J)).value


but that doesnt seem to work.

Thanks
gary

Bob Phillips
07-28-2008, 06:54 AM
.Cells(4, J).Value