我正在其計算每名員工每週檢視小時的時間片之前相同。我已經實施了一些代碼,用於確定員工是否屬於公司,無薪休假,離開公司或已經離職。如何檢查是否單元格的行前是增加了反
我想要做的就是創建一個表,告訴我加入者,畢業生和按周的無薪休假的數量。
應用代碼到我的數據進行排序後,它看起來是這樣的:
我想創建一個表,增加了木匠櫃檯首次行的值未加入」所以我不重複計數英寸例如,ID 1,我不想指望那個人在周2木匠 - 5,只有在周2
這是到目前爲止我的代碼,我在移動之前在看每列行下一列:
Dim LastCol As Long
Dim LastRow As Long
Dim I As Long
Dim Z As Long
Dim Q As Long
Dim Joined As Integer
Dim ws As Worksheet
'set worksheet to use
Set ws = Sheets("Sheet1")
With ws
'Find last col and row for range
LastCol = ws.Cells(3, Columns.Count).End(xlToLeft).Column
LastRow = ws.Cells(Rows.Count, D).End(xlUp).Row
For I = 3 To LastCol
NotJoined = 0
For Z = 4 To LastRow
'check if cell is > 0
If ws.Cells(Z, I).Value > 0 Then
Joined = Joined + 1
End If
Next Z
'Find last row and add value to row below
Q = ws.Cells(Rows.Count, I).End(xlUp).Row
ws.Cells(Q + 1, I).Value = Joined
Next I
End With
我將如何添加一個方法來只能算一個木匠(打算從沒有加入任何其他值)/離校生一次(從任意值X會)的任何給定行中卻發現這些價值每週。我正在朝着具有類似於下面的表:
提前感謝!