i = 12 '橫向填入料號
For C = 0 To 200
If i > Worksheets.Count Then
Exit For
Else
A = Application.CountIf(Worksheets(i).Range("i5:z10"), "PO")
b = Application.CountIf(Worksheets(i).Range("i1:z1"), "xxxx")
EA = A - b
For G = 0 To EA
Worksheets("FCST").Range("b1").Offset(, C + G).Value = Worksheets(i).Name
Worksheets("FCST").Range("b1").Offset(1, C + G).Value = Worksheets(i).Range("d1").Offset(0, G * 6) '料號
Worksheets("FCST").Range("b1").Offset(2, C + G).Value = Worksheets(i).Range("c1").Offset(0, G * 6) '尺寸
Worksheets("FCST").Range("b1").Offset(3, C + G).Value = Worksheets(i).Range("c2").Offset(0, G * 6) '廠商
myRow = Worksheets(i).Range("a:a").Find(myToday).Row '直向填入PO/FCST數量, myRow+myDay
k = 0
For j = 0 To myDay
If k > myDay Then
Exit For
Else
If Worksheets(i).Range("e" & myRow).Offset(k + 1, G * 6).Value <> 0 Then
Worksheets("FCST").Range("a4").Offset(j + 2, C + 1 + G).Value = "*" & Worksheets(i).Range("e" & myRow).Offset(k + 1, G * 6)
Else
Worksheets("FCST").Range("a4").Offset(j + 2, C + 1 + G).Value = Worksheets(i).Range("d" & myRow).Offset(k + 1, G * 6)
End If
k = k + 1
End If
Next j
Next
End If
C = C + EA
i = i + 1
Next C
End If作者: 准提部林 時間: 2019-5-15 10:06