-
Solved: Copying a sheet from a different workbook
Can anybody please tell me the quickest way to copy the cell values only from an entire sheet from a different workbook.
Is there a way to copy and paste using one line of code
EG Book1.Sheet1.Cells.Copy Destination =: Book2.Sheet2 ValuesOnly
This is what I have so far
[vba]Set Book1 = ActiveWorkbook
Set Data = Worksheets("Data")
Application.Workbooks.Open("Book2.xls")
Set Book2 = ActiveWorkbook
Set ProductKeys = Worksheets("PKeys")
ProductKeys.Cells.Copy
Book1.Activate
Data.Range("A1").Select
Data.Paste[/vba]
Last edited by Aussiebear; 10-15-2011 at 03:58 AM.
Reason: Applied VBA tags to code
-
[VBA]Book1.Sheet1.UsedRange.ClearContents
With Book2.Sheet2.UsedRange
Book1.Sheet1.Range(.Address).Value = .Value
End With[/VBA]
.
-
Excellent, just what I was after. Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules