How come below code works:
.Range("D4:F4").copy
.cells(1,1).PasteSpecial
While below doesn't work:
.Range("D4:F4").copy
.cells(1,1).Paste
I realize that the correct syntax is
.Range("D4:F4").copy Destination:=
The answer is very simple .Paste
is not a property of the Cells
object but of the Worksheet
Object
If you type .
after the Cells
, Intellisense will confirm that fact :)
There are various ways to copy data across.
If you want to only copy values across and not the formatting then this is the best way
rng1.Value = rng2.Value
If you want to carry the formatting then either you can use
Rng1.copy Rng2
or
Rng1.Copy
rng2.pastespecial
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With