Sub Macro1()
Dim for_S3 As Long, d As Long
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim wb3 As Workbook
Set wb1 = Workbooks("1.xlsx")
Set wb2 = Workbooks("2.xlsx")
Set wb3 = Workbooks("3 Final.xlsm")
d = 3
For for_S3 = 1 To 12
Windows("3 Final.xlsm").Activate
Workbooks("3 Final.xlsm").Worksheets("Sheet 2").Range(Cells(2, d), Cells(65, d)).Copy
wb2.Worksheets("RAW MATERIALS PLANNER_ALL").Range("C5").PasteSpecial Paste:=xlPasteValues
wb2.Worksheets("RAW MATERIALS PLANNER_ALL").Range("I3:I5000").Copy
wb3.Worksheets("Sheet 3").Range(Cells(2, d), Cells(65, d)).PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
d = d + 1
Next
End Sub
Can anyone help me figure out what's wrong with the codes? It's showing
runtime error "1004" Application-defined or object-defined error
for the line Workbooks("3 Final.xlsm").Worksheets("Sheet 2").Range(Cells(2, d), Cells(65, d)).Copy
.
I really dont see what's wrong with it.