Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Range.Select with variable cells ?

Hello,

I am having a devil of a time trying to find out how to use Range.Select
(or something else) with rows and columns that vary.

row1 = x1
row2 = x2
col1 = y1
col2 = y2

x1=1
x2=2
y1=1
y2=2


Range(R[x1]C[y1]:R[x2]C[y2]).Select

or

Range(R[x1]C[y1+1]:R[x1]C[y2+2]).Select

is what I am trying to accomplish but I keep getting errors.
How do I use the Range statement (or something else) in the
above statements?


Lance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Range.Select with variable cells ?

Try this

Sub test()
x1 = 1
x2 = 2
y1 = 1
y2 = 2

Range(Cells(x1, y1), Cells(x2, y2)).Select
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



wrote in message ...
Hello,

I am having a devil of a time trying to find out how to use Range.Select
(or something else) with rows and columns that vary.

row1 = x1
row2 = x2
col1 = y1
col2 = y2

x1=1
x2=2
y1=1
y2=2


Range(R[x1]C[y1]:R[x2]C[y2]).Select

or

Range(R[x1]C[y1+1]:R[x1]C[y2+2]).Select

is what I am trying to accomplish but I keep getting errors.
How do I use the Range statement (or something else) in the
above statements?


Lance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Range.Select with variable cells ?

Lance,

Range(Cells(x1,y1),Cells(x2,y2)).Select
or
Range(Cells(x1,y1+1),Cells(x1,y2+2)).Select

--
sb
wrote in message
...
Hello,

I am having a devil of a time trying to find out how to use Range.Select
(or something else) with rows and columns that vary.

row1 = x1
row2 = x2
col1 = y1
col2 = y2

x1=1
x2=2
y1=1
y2=2


Range(R[x1]C[y1]:R[x2]C[y2]).Select

or

Range(R[x1]C[y1+1]:R[x1]C[y2+2]).Select

is what I am trying to accomplish but I keep getting errors.
How do I use the Range statement (or something else) in the
above statements?


Lance



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
Select a variable range Bluecat Excel Worksheet Functions 7 January 13th 09 01:24 AM
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
Using a variable for range of cells Chart_Maker_Wonderer Excel Discussion (Misc queries) 3 March 4th 07 12:05 PM
Use a Variable to select a range Connie Excel Discussion (Misc queries) 3 October 19th 06 05:48 PM
Range("C9:V9").Select ==> changing the 9 to a variable B. F. Excel Worksheet Functions 8 May 23rd 05 01:16 PM


All times are GMT +1. The time now is 03:01 AM.

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

About Us

"It's about Microsoft Excel"