Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Variable in a range.

Hi. thanks for the previous help. I have been able to continue merrily until
the point where I would like to use a variable in a range:
destination:=range("A10:A" & <variable) etc
How can I get a variable into the 1st part? the range will always start in
column A but the start and end row may vary.

tx,Chris


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Variable in a range.

another approach could be

Range("A" & var1).Resize(var2-Var1+1,1)

or

Range(cells(var1,1),cells(var2,1))



--
Regards,
Tom Ogilvy

"Chris" wrote in message
...
Hi. thanks for the previous help. I have been able to continue merrily

until
the point where I would like to use a variable in a range:
destination:=range("A10:A" & <variable) etc
How can I get a variable into the 1st part? the range will always start in
column A but the start and end row may vary.

tx,Chris




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Variable in a range.

I haven't been following your previous postings. I assume that you are
trying to vary the starting and ending cells.

Destination:=Range("A" & var1 & ":A" & var2)

Sub VariableAddress()
Dim var1 As Long, var2 As Long
Dim rngV As Range
var1 = 10: var2 = 15
Set rngV = Range("A" & var1 & ":A" & var2)
Debug.Print rngV.Address
End Sub

Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

Hi. thanks for the previous help. I have been able to continue merrily until
the point where I would like to use a variable in a range:
destination:=range("A10:A" & <variable) etc
How can I get a variable into the 1st part? the range will always start in
column A but the start and end row may vary.

tx,Chris


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
Variable Range James C. Excel Discussion (Misc queries) 3 April 2nd 09 12:41 AM
Variable range in VB famdamly Excel Discussion (Misc queries) 2 January 22nd 06 02:29 PM
Variable in Range aftamath Excel Discussion (Misc queries) 2 October 6th 05 07:48 PM
variable range: l just can't get there! ste mac Excel Programming 2 October 27th 03 06:43 PM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


All times are GMT +1. The time now is 06:08 AM.

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"