What I'm trying to do is create a module that, when ran, will take specific cells within an open workbook (Called MCCIP Template) and then save them into a specific, unopened workbook (called CIP Directory). Workers will fill out this MMCIP Template, click a button containing the module, and the module will do the rest. They fill out this MMCIP Template a lot, I want this CIP Directory to keep track of all the important information (Date, Time, as well as other relevant info).
I've got the save part down, that's obviously easy. The issue comes when I try to copy and paste info from the open workbook into the closed workbook. The section of code for copying just this one cell looks like this:
Sub CopyMCCIPtoDirectory()
'Define variables
Dim InputFile As Workbook
Dim OutputFile As Workbook
Dim Inputpath As String
Dim Outputpath As String
'Opening both workbooks
Set InputFile = ActiveWorkbook
Set OutputFile = Workbooks.Open("Z:\Old Co-Op Files\Chauncey Depew IV\Misc and One Timers\CIP Directory.xlsm")
'Copy and Paste relevant data
InputFile.Sheets("CURD CIP SHEET").Activate
InputFile.Sheets("CURD CIP SHEET").Range("B3").Copy
OutputFile.Sheets("Main Plant").Activate
OutputFile.Sheets("Main Plant").Range("A1").End(xlDown).Offset(1, 0).Select.PasteSpecial Paste:=xlPasteValues
'Close CIP Directory
OutputFile.Close savechanges:=True
MsgBox "CIP Checklist Successfully Saved and Logged"
End Sub
The line causing the issue is the OutputFile.Sheets("Main Plant").Range("A1").End(xlDown).Offset(1,0).Select.PasteSpecial Paste:=xlPasteValues
I'm getting "Run-time error 1004: Application-defined or object-defined error"
I've done some Googling and can't seem to find what exactly the issue is.
Bookmarks