PDA

View Full Version : Solved: Paste Special between Worksheets



alex108
05-30-2007, 05:05 AM
I must be missing something on syntax and could use some help with Paste Special-
This code works to copy a cell between Worksheets, but brings the format over-

Worksheets("Sheet1").Range("C1").Copy _
Destination:=Worksheets("printout").Range("C3")

I can copy values only on the same worksheet with the following and it works

With Worksheets("printout")
.Range("C3").Copy
.Range("G3").PasteSpecial xlPasteValues
End With

But if I try to copy between worksheets using the format of the first example I get a runtime error 1004, if I take out the = sign (like in the second example that works within a sheet)I get compiler error. I know it must be syntax but every example I find doesn't seem to work

Worksheets("Sheet1").Range("C1").Copy _
Destination:=Worksheets("printout").Range("C3").PasteSpecial = xlPasteValues

mdmackillop
05-30-2007, 05:11 AM
You must Paste with a separate line of code when using PasteSpecial

Worksheets("Sheet1").Range("C1").Copy
Worksheets("printout").Range("C3").PasteSpecial xlPasteValues

alex108
05-30-2007, 05:25 AM
Thankyou,
That did the trick. Is it just good practice to use "Destination", or is it only in certain circumstances, or overkill. I always use it but it seems to get me an error at times.