run time error 1004

rjplante

Well-known Member
Joined
Oct 31, 2008
Messages
574
Office Version
  1. 365
Platform
  1. 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!

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
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,224,514
Messages
6,179,225
Members
452,896
Latest member
IGT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top