|
据姓名判断转置日期
Sub 据姓名判断转置日期()
arr = Sheets("缺勤").Range("B3:E" & Sheets("缺勤") _
.Cells(Rows.Count, 5).End(xlUp).Row)
Set d = CreateObject("scripting.dictionary")
For dt = 1 To UBound(arr)
If d.exists(arr(dt, 4)) Then
d(arr(dt, 4)) = d(arr(dt, 4)) & " " & arr(dt, 1)
Else
d(arr(dt, 4)) = arr(dt, 1)
End If
Next
Sheets("缺勤转置").Range("a3:b" & Sheets("缺勤转置").Cells(Rows.Count, 2).End(xlUp).Row).Clear
Sheets("缺勤转置").[a3].Resize(d.Count, 1) = Application.Transpose(d.keys)
Sheets("缺勤转置").[b3].Resize(d.Count, 1) = Application.Transpose(d.items)
Set d = Nothing
End Sub
|
|