|
1学分
我希望每次執行DO循環時下面下面標紅的這個2可以加1,
Dim r As Worksheet, i As Long, e As Worksheet, W As Long
Set r = Worksheets("匯總")
Set e = Worksheets("原始數據")
W = e.Cells(Rows.Count, 1).End(xlUp).Row
r.Range("b2:f1100") = ""
i = 2
e.Activate
Do While r.Cells(i, 1) <> ""
r.Cells(i, 2) = e.Application.WorksheetFunction.CountIfs(Range("v:cm"), r.Cells(i, 1))
e.Range("b2" & ":" & "b" & W) = "=COUNTIFS(C2:XFD2,匯總!A$2)"
r.Cells(i, 3) = Application.WorksheetFunction.CountIfs(e.Range("b:b"), "=1", e.Range("c:c"), "REPAIR OK")
r.Cells(i, 4) = Application.WorksheetFunction.CountIfs(e.Range("b:b"), ">1", e.Range("c:c"), "REPAIR OK") + Application.WorksheetFunction.CountIfs(e.Range("b:b"), ">=1", e.Range("c:c"), "Scraped")
r.Cells(i, 5) = r.Cells(i, 3) / r.Cells(i, 2)
r.Cells(i, 6) = Application.WorksheetFunction.CountIfs(e.Range("b:b"), ">=1", e.Range("c:c"), "REPAIR OK") / r.Cells(i, 2)
i = i + 1
Loop
End Sub
|
|