Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting First and Last Cells in Ranges Magnivy Excel Programming 6 May 29th 06 04:46 AM
Selecting multiple ranges using 'Cells' notation Pete[_22_] Excel Programming 4 June 30th 05 05:42 PM
Selecting ranges of cells Dale Fye Excel Programming 5 March 10th 05 12:50 AM
Selecting ranges Steve Wood Excel Programming 1 August 24th 04 02:16 PM
Selecting two ranges of unadjacent cells CTInt04 Excel Programming 3 July 7th 04 07:48 PM


All times are GMT +1. The time now is 09:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"