- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 16
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-14
|
¥»©«³Ì«á¥Ñ luhpro ©ó 2014-9-20 11:05 ½s¿è
¦^´_ 3# adam2010
¨Ï¥ÎÀx¦s®æ¤½¦¡ªº¤è¦¡§Ú·Q¤£¥X¨Ó,
¦b¦¹´£¨Ñ¤@Ó Excel VBA µ{¦¡§¹¦¨ªº¤è¦¡:- Sub nn()
- Dim iI%
- Dim lRow&
- Dim sItem$
- Dim bNFind As Boolean
- Dim dDate As Date
- Dim vA(), vD
-
- ReDim vA(0 To 2, 0)
- Set vD = CreateObject("Scripting.Dictionary")
-
- lRow = 2
- With Sheets("Á`ªí")
- Do While .Cells(lRow, 1) <> ""
- With .Cells(lRow, 1)
- sItem = .Text
- dDate = .Offset(, 2)
- If Not vD.exists(sItem) Then
- ReDim Preserve vA(0 To 2, UBound(vA, 2) + 1)
- vA(0, UBound(vA, 2)) = dDate
- vD(sItem) = UBound(vA, 2)
- Else
- bNFind = True
- For iI = 0 To 2
- If dDate = vA(iI, vD(sItem)) Then bNFind = False
- Next
- If bNFind Then
- If vA(1, vD(sItem)) = "" Then
- vA(1, vD(sItem)) = dDate
- vA(2, vD(sItem)) = #12/31/9999#
- Else
- If dDate > vA(1, vD(sItem)) Then
- If dDate < vA(2, vD(sItem)) Then vA(2, vD(sItem)) = dDate
- Else
- If dDate < vA(0, vD(sItem)) Then
- vA(0, vD(sItem)) = dDate
- vA(1, vD(sItem)) = vA(0, vD(sItem))
- vA(2, vD(sItem)) = vA(1, vD(sItem))
- Else
- vA(1, vD(sItem)) = dDate
- vA(2, vD(sItem)) = vA(1, vD(sItem))
- End If
- End If
- End If
- End If
- End If
- End With
- lRow = lRow + 1
- Loop
- End With
-
- lRow = 2
- With Sheets("°lÂÜ")
- Do While .Cells(lRow, 1) <> ""
- With .Cells(lRow, 1)
- If vD.exists(.Text) Then
- For iI = 0 To 2
- .Offset(, iI + 1) = vA(iI, vD(.Text))
- Next
- End If
- End With
- lRow = lRow + 1
- Loop
- End With
- End Sub
½Æ»s¥N½X |
|