run time error 1004

rjplante

Well-known Member
Joined
Oct 31, 2008
Messages
574
Office Version
  1. 365
Platform
  1. Windows
I get a run time error '1004' Application-defined or object-defined error. My code debugger highlightes the line below. What does this mean?

Thanks for the help.

Robert

Rich (BB code):
Sheets("Bag Data Transfer").Range("A2:End(xlRight)").Copy

Here is the blow of code surrounding this line.

Rich (BB code):
' TRANSFER BAG SET DATA AND OVERWRITE EXISTING DATA

File1 = ActiveWorkbook.Name

Application.ScreenUpdating = False

'open QC Data trendline workbook

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\PCB Bag Set Trendline.xlsm"

ActiveSheet.Unprotect Password:="bioe1025"
Range("DA1").ClearContents

Workbooks(File1).Activate

Sheets("QC5003.5B FINAL QC BAG SET").Visible = True
Sheets("QC5003.5B FINAL QC BAG SET").Range("Z15").Copy
Workbooks("PCB Bag Set Trendline.xlsm").Activate
Sheets("Bag Set Data").Range("DA1").PasteSpecial Paste:=xlPasteValues


Workbooks(File1).Activate
' copy data
Sheets("Bag Data Transfer").Visible = True
Sheets("Bag Data Transfer").Range("A2:End(xlRight)").Copy

Workbooks("PCB Bag Set Trendline.xlsm").Activate

'Loop to find row
Range("A2").Select

Do

If ActiveCell.Value <> Range("DA1").Value Then
Selection.Offset(1, 0).Select
End If

Loop Until ActiveCell.Value = Range("DA1").Value

ActiveCell.Offset(0, 1).Select
ActiveCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
Application.CutCopyMode = False

End If
ActiveSheet.Protect Password:="bioe1025"

ActiveWorkbook.Save
ActiveWorkbook.Close
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
This solution did not flag an error message but it only transferred the last bit of data in the row. I need it to copy everything from A2 to the end of the row which varies in length.

Thanks for the help,

Robert
 
Upvote 0
Maybe this?

Code:
    With Sheets("Bag Data Transfer")
        Range(.Range("A2"), .Cells(2, Columns.Count).End(xlToLeft)).Copy
    End With
 
Upvote 0

Forum statistics

Threads
1,224,540
Messages
6,179,417
Members
452,912
Latest member
alicemil

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