PDA

View Full Version : Solved: Copying a sheet from a different workbook



gmcconville
10-14-2011, 10:31 PM
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

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

mikerickson
10-15-2011, 12:25 AM
Book1.Sheet1.UsedRange.ClearContents
With Book2.Sheet2.UsedRange
Book1.Sheet1.Range(.Address).Value = .Value
End With
.

gmcconville
10-15-2011, 03:54 AM
Excellent, just what I was after. Thanks