Public Sub 特休統計練習()
Application.ScreenUpdating = False
Arr = [特休天數!A1].CurrentRegion
Brr = [登錄!A1].CurrentRegion
For x = 2 To UBound(Arr)
If Brr(1, 2) = Arr(x, 1) And _
Brr(3, 2) >= Arr(x, 4) And _
Brr(3, 2) <= Arr(x, 5) Then
Sheets(2).Cells(3, 4) = Arr(x, 8)
Sheets(1).Cells(x, 9) = _
Sheets(1).Cells(x, 9) + Brr(3, 3)
A = Arr(x, 1) & "|" & Arr(x, 2) & "|" & _
Brr(3, 1) & "|" & Brr(3, 2) & "|" & _
Brr(3, 3) & "|" & Sheets(2).Cells(3, 4)
A = Split(A, "|")
For Y = 1 To 6
Sheets(3).Cells(Rows.Count, Y).End(xlUp)(2) = A(Y - 1)
Next Y
Exit For
End If
Next x
Application.ScreenUpdating = True
End Sub
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/) |