Hey Guys,
I'm trying to write a macro that copies values from one sheet and pastes them into Sheet1 in a different workbook.
I have the code below, but it errors out at the pasting step ( Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone )
The error is:
"Run-time error '1004';
PasteSpecial method of Range Class failed"
Anyone have any idea what's going on?
Thanks!
Sub InventorySave()
Dim wbk As Workbook
Sheet4.Range("A1:G1000").Copy
Set wbk = Workbooks.Open("C:\Users\Matt.Matt-Laptop\Desktop\InventoryTemplate.xlsm")
With wbk.Sheets("Sheet1")
Range("A1:G1000").ClearContents
Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\Users\Matt.Matt-Laptop\Desktop\InventoryTemplate.xlsm", FileFormat:=52
ActiveWorkbook.SaveAs Filename:="C:\Users\Matt.Matt-Laptop\Desktop\Inventory Upload.txt", FileFormat:=xlTextWindows
Application.DisplayAlerts = True
ActiveWorkbook.Close False
End With
End Sub
Bookmarks