Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting ranges with Cells()
Can someone tell me how to specify a range with the Cells command?
On the spreadsheet level, you can use OFFSET to not only specify the offset cell starting point, but also how many cells across and down you'd like to reference. (i.e. "=OFFSET(A1,0,0,1,5)") In VBA, the Offset only seems to let you specify the offset cell. I'd like to be able to specify a range with a single Cells command like: Cells(1,1).Offset(0,0,1,5).Select ' Select A1:E1 What syntax would I use to designate a range using Cells? Thanks! John |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting ranges with Cells()
Hi Robotman,
Try: Set Rng = Range("A1").Resize(1,5) --- Regards, Norman "robotman" wrote in message ups.com... Can someone tell me how to specify a range with the Cells command? On the spreadsheet level, you can use OFFSET to not only specify the offset cell starting point, but also how many cells across and down you'd like to reference. (i.e. "=OFFSET(A1,0,0,1,5)") In VBA, the Offset only seems to let you specify the offset cell. I'd like to be able to specify a range with a single Cells command like: Cells(1,1).Offset(0,0,1,5).Select ' Select A1:E1 What syntax would I use to designate a range using Cells? Thanks! John |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting ranges with Cells()
You really want to use a range to do what you are asking something like this...
Range(cells(1,1), cells(2,6)).Select or Range(cells(1,1), cells(1,1).Offset(1,5)).Select -- HTH... Jim Thomlinson "robotman" wrote: Can someone tell me how to specify a range with the Cells command? On the spreadsheet level, you can use OFFSET to not only specify the offset cell starting point, but also how many cells across and down you'd like to reference. (i.e. "=OFFSET(A1,0,0,1,5)") In VBA, the Offset only seems to let you specify the offset cell. I'd like to be able to specify a range with a single Cells command like: Cells(1,1).Offset(0,0,1,5).Select ' Select A1:E1 What syntax would I use to designate a range using Cells? Thanks! John |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting ranges with Cells()
Thanks for the syntax ideas.
Why do you think I need to use Range()? Currently I use the double Cells() in the Range() command, but this seems very clunky. I'm trying to simply the code by not needing the double Cells() commands. I'll try Resize to see if that gives me full functionality when selecting a range. I'm guessing it has limitations. Any other ideas to simply range selections with out using letter (i.e. "A1") cell-referencing? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Selecting First and Last Cells in Ranges | Excel Programming | |||
Selecting multiple ranges using 'Cells' notation | Excel Programming | |||
Selecting ranges of cells | Excel Programming | |||
Selecting ranges | Excel Programming | |||
Selecting two ranges of unadjacent cells | Excel Programming |