question

aaron-2749 avatar image
0 Votes"
aaron-2749 asked Viorel-1 commented

Run-time error '1004': Application-defined or object-defined error

Sub test()
Dim LR As Long, i As Long
With Sheets("Sheet1")
LR = .Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LR
.Rows(i).Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(.Range("E" & i).Value)
Next i
End With
End Sub

I have been using this same quantity duplicator macro for a little over 3 years now, and I have never had any issues. Yesterday was the first time I have had to use it after several months, and I got this error. When I click debug, it highlights this row:

     .Rows(i).Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(.Range("E" & i).Value) 

Can anybody take a look at this and see what the problem could be?

Thank you for your time and input,

Aaron

office-vba-dev
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@aaron-2749
As tag "office-for-mac-itpro" focus more on general issues of Office clients on Mac, I would remove it, thanks for your understanding.

0 Votes 0 ·

Which value to put in Sheet1 and Sheet2 to reproduce the problem? It seems that the macro does not work if the E column is empty, for example.

0 Votes 0 ·

0 Answers