View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] pfsardella@yahoo.com.nospam is offline
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