|
没排错。先看看行不行。
- Private Sub CommandButton1_Click()
- Dim vntD, A&, vntRslt()
- Dim dicJobDate As Object, strJobDate$
- Dim lngNums&(), lngIncrNum&, lngCurrNum&
- vntD = Sheets("sheet1").Range([A2], [D50000].End(xlUp))
- Set dicJobDate = CreateObject("scripting.dictionary")
- For A = 1 To UBound(vntD)
- strJobDate = vntD(A, 3) & "|" & Format(vntD(A, 4), "yyyy/mm/dd")
- If Not dicJobDate.exists(strJobDate) Then
- lngIncrNum = dicJobDate.Count
- dicJobDate(strJobDate) = lngIncrNum
- ReDim Preserve vntRslt(13, lngIncrNum), lngNums(lngIncrNum)
- lngNums(lngIncrNum) = 1
- vntRslt(0, lngIncrNum) = vntD(A, 1)
- vntRslt(1, lngIncrNum) = vntD(A, 2)
- vntRslt(2, lngIncrNum) = vntD(A, 3)
- vntRslt(3, lngIncrNum) = CDate(Format(vntD(A, 4), "yyyy/mm/dd"))
- vntRslt(4, lngIncrNum) = TimeValue(vntD(A, 4))
- Else
- lngCurrNum = dicJobDate(strJobDate)
- lngNums(lngCurrNum) = lngNums(lngCurrNum) + 1
- vntRslt(3 + lngNums(lngCurrNum), lngCurrNum) = TimeValue(vntD(A, 4))
- End If
- Next
- Sheets("sheet2").Range("A2").Resize(lngIncrNum + 1, 14) = Application.WorksheetFunction.Transpose(vntRslt)
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|