I am trying to copy data from multiple other workbooks (in this example, just one wother workbook- "Machine Charting Entry.xlsm" ) into one main workbook ("OEE Charting.xlsm"). All of the data in the 'other' workbooks is layed out the same way as in OEE Charting, but has varying lengths of data. The problem that I am having is from an error when I try to paste the code into OEE Charting, there is an error "Object doesn't support this property or method" and I cannot find a way to fix it.
Sub Import_Recorded_Data()
Dim wbk As Workbook
Dim strOEEMaster As String
Dim strMachEntry As String
Dim strWeldEntry As String
strOEEMaster = "G:\OEE\Master\OEE Charting.xlsm"
strMachEntry = "G:\OEE\Machine\Machine Charting Entry.xlsm"
ThisWorkbook.Sheets("Enter Data").Range("A2:AA60000,D7:E60000,H7:I60000,K7:U60000").ClearContents
Set OEE = Workbooks("OEE Charting.xlsm")
Set wbk = Workbooks.Open(strMachEntry)
With wbk.Sheets("Entered Machine Data")
Sheets("Entered Machine Data").Visible = True
LastRowMCE = Sheets("Entered Machine Data").Range("A" & Rows.Count).End(xlUp).Row
Range(Cells(2, 1), Cells(LastRowMCE, 27)).Copy
End With
Set wbk = ThisWorkbook
With wbk.Sheets("Enter Data")
OEE.Range("A2").Paste
End With
Workbooks("Machine Charting Entry.xlsm").Sheets("Entered Machine Data").Visible = False
Workbooks("Machine Charting Entry.xlsm").Close (False)
End Sub
I have also tried using .range(cells(2,1),cells(LastRowMCE,27)).paste, but it still returns an error.
Am I referencing the main workbook incorrectly?
Thanks in advance
Bookmarks