Hey guys,
How do I copy and paste values only in VBA using the .Copy method?
My current code is listed below, but it does a normal copy/paste:
Thanks!![]()
Sheets("Inv").Rows(LSearchRow).Copy Sheets("CA").Rows(LCopyToRow)
Hey guys,
How do I copy and paste values only in VBA using the .Copy method?
My current code is listed below, but it does a normal copy/paste:
Thanks!![]()
Sheets("Inv").Rows(LSearchRow).Copy Sheets("CA").Rows(LCopyToRow)
To do that you need to break it into two lines like this:
![]()
Sheets("Inv").Rows(LSearchRow).Copy Sheets("CA").Rows(LCopyToRow).PasteSpecial xlValues
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
Hello Session101,
You can do this two different ways. First, you can modify your copy statement to use PasteSpecial.
The second way is by direct assignment. This method only works with the Value property. Eventhough the Value property is the default property for a Range, you still must specify the property for the block transfer to work.![]()
Sheets("Inv").Rows(LSearchRow).Copy Sheets("CA").Rows(LCopyToRow).PasteSpecial Paste:=xlPasteValues
![]()
Sheets("Inv").Rows(LSearchRow).Cells.Value = Sheets("CA").Rows(LCopyToRow).Cells.Value
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks