View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Using Range Object With Two Variables

Hi Alatl,

Try replacing:

Range("UserName_Addr: Resp_Addr")


with

Range("UserName_Addr & ":" & Resp_Addr")


---
Regards,
Norman



"ALATL" wrote in message
...
I get an error when I try & pass the range object two variables. I have
tested this & it allows the use of one varaible. But I would like to use
two
variables to copy & paste cell A8:D8. Is there something wrong with my
syntax
or will I need to copy & paste one row at a time?


Dim UserName_Addr As String ' Where UserName_Addr = A8
Dim Resp_Addr As String ' Where Resp_Addr = D8

'Copy columns A,B,C, and D from Sheet 1 to Sheet 2
With Sheets("Sheet1")
.Range(.Range("UserName_Addr: Resp_Addr"),
.Range("A65536").End(xlUp)).Copy
End With
Sheets("Sheet2").[A65536].End(xlUp)(1).PasteSpecial Paste:=xlValues


Thx!
ALATL