I know there are a lot of topics related to the the error 1004 (object or app error) when you try to copy paste range from one sheet to another, but I do not understand something (I am still a beginner with VBA).
I have a Excel file with 2 sheets :
- "Worksheet1" with the data I want to copy
- "Feuil1" where I want to paste data with a specific layout
To understand my problem, take a look at my code
Dim a As Integer
Dim b As Integer
Dim val4 as integer
val4 = 4
a = 2
b = 1
For i = 1 To val4
Worksheets("Worksheet1").Range(Worksheets("Worksheet1").Cells(a, 1), Cells(a + 2999, 1)).Copy Destination:=Worksheets("Feuil1").Range(Worksheets("Feuil1").Cells(2, b), Cells(a + 2999, b))
a = a + 3000
b = b + 1
Next i
Note : in the full code, val4 was already used before this part.
When I try to run it, I obtain error 1004 (object or app error). From what I have read, I believe the problem comes from "Cells" property where the working sheet must be specified (unlike range) but I do not understand why my code failed for copying.
Could someone explain it to me?