rjplante
Well-known Member
- Joined
- Oct 31, 2008
- Messages
- 574
- Office Version
- 365
- Platform
- Windows
I have a 'Run-time error '1004': Application-defined or object-defined error". The line flagged is listed below. not sure what to do to fix it. The sheet listed in the original workbook is hidden and I have written code to unhide the worksheet that contains the data all to no avail.
Thanks for any assistance!
Thanks for any assistance!
Rich (BB code):
If Sheets("QC5003.17 Cryobag Testing Main").Visible = False Then
Sheets("QC5003.17 Cryobag Testing Main").Visible = True
End If
'Assigns the name File1 to the active workbook.
File1 = ActiveWorkbook.Name
ChDir "\\Ferrari\common\Product QC\BioPrep QC\PrepaCyte-CB\PrepaCyte-CB QC\510k Lot Testing\PCB QC Trendline Data"
Workbooks.Open Filename:= _
"\\Ferrari\common\Product QC\BioPrep QC\PrepaCyte-CB\PrepaCyte-CB QC\510k Lot Testing\PCB QC Trendline Data\Master Cryobag Testing Log.xlsm"
Workbooks("Master Cryobag Testing Log.xlsm").Activate
ActiveSheet.Unprotect Password:="bioe1025"
'If cell B2 is blank, data is pasted in the second row.
If Range("B2").Value = "" Then
Workbooks("Master Cryobag Testing Log.xlsm").Sheets("Main Log Data").Range("B2:G2").Value = Workbooks(File1).Sheets("QC5003.17 Cryobag Testing Main").Range("BA5:BF5").Value
Else
'If B2 is full, it startes at cell B1, moves to the last filled row,
'moves down one row and then pastes the data.
Workbooks("Master Cryobag Testing Log.xlsm").Sheets("Main Log Data").Range("B1").End(xlDown).Offset(1, 0).Resize(0, 5).Value = Workbooks(File1).Sheets("QC5003.17 Cryobag Testing Main").Range("BA5:BF5").Value
End If