View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] carlos_ray86@hotmail.com is offline
external usenet poster
 
Posts: 67
Default Copy and paste between sheets error

I am having a little problem with this code. It won't copy and paste
from one worksheet to another. I have used the same code for copy and
paste before but never in a find loop so I'm guessing maybe I have to
do something different. I also tried

Workbooks("Book1.xls").Worksheets(2).Range(Cells(y , 1), Cells(y,
2)).PasteSpecial Paste:=xlPasteAll

Worksheets(2).Range(Cells(y, 1), Cells(y, 2)).PasteSpecial
Paste:=xlPasteAll

Worksheets("SatLog").Range(Cells(y, 1), Cells(y, 2)).PasteSpecial
Paste:=xlPasteAll

None worked

With Worksheets(1).Range("A1:A500")
Set c = .Find("Substrate # 1", LookIn:=xlValues)

If Not c Is Nothing Then
firstAddress = c.Address
y = 1
Do

Range(c.Offset(0, 0), c.Offset(3, 1)).Copy
Workbooks("Book1.xls").Worksheets("SatLog").Range( Cells(y,
1), Cells(y, 2)).PasteSpecial Paste:=xlPasteAll <--------Errors here
Set c = .FindNext(c)
y = y + 4

Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With