View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Selection.Copy used in a variable.

You do not copy cells to a variable and then pass the variable. Try something
more like this...

With Workbooks("TEMPLATE.xlsx")
Range("A1", Cells(Rows.Count, "A").End(xlUp)).Copy _
.Worksheets.Add(After:=.Worksheets(.Worksheets.Cou nt)).Range("A1")
end with
--
HTH...

Jim Thomlinson


"Rick S." wrote:

How do I pass the variable "vData"?
'======
lRow = Range("A1").End(xlDown).Address
'MsgBox lRow 'for testing
vData = Range("A1:" & lRow).Copy
With Workbooks("TEMPLATE.xlsx")
.Worksheets.Add After:=.Worksheets(.Worksheets.Count)
vData.Paste 'Object required?
End With
'======
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007