ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Paste values (https://www.excelbanter.com/excel-programming/284665-paste-values.html)

squirmy

Paste values
 
Hello. Please help.

I am trying, in a single VBA code line if possible, to
copy the entire sheet and "paste special - values" right
over the top of the existing data.

My code follows, but I get an error even though it seems
to me it should work. Can someone correct my code or
please supply me with a functional equivalent?

Cells.Copy Destination:=Range("A1").PasteSpecial _
(Paste:=xlPasteValues)

Thanks much in advance for your example code and
assistance.

Otto Moehrbach[_5_]

Paste values
 
The code:
Cells.Copy Range("A1")
with a space after Copy says to copy the sheet and paste it to A1.
If you want to paste values only you need two lines:
Cells.Copy
[A1].PasteSpecial xlPasteValues
Application.CutCopyMode = False

The 3rd line clears the clipboard.
HTH Otto
"squirmy" wrote in message
...
Hello. Please help.

I am trying, in a single VBA code line if possible, to
copy the entire sheet and "paste special - values" right
over the top of the existing data.

My code follows, but I get an error even though it seems
to me it should work. Can someone correct my code or
please supply me with a functional equivalent?

Cells.Copy Destination:=Range("A1").PasteSpecial _
(Paste:=xlPasteValues)

Thanks much in advance for your example code and
assistance.





All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com