¦^´_ 10#john2006168
¸Õ¸Õ¬Ý
Sub ex()
Dim d As Object, a As Variant
Set d = CreateObject("Scripting.dictionary")
For Each a In Range([E2], [E65535].End(3)) '¦bEÄæ¦ì¸m§ä´M¸ê®Æ
If Not d.exists(a.Value) Then '¦r¨å¤¤§ä¤£¨ì¸ê®Æ
d(a.Value) = a.Offset(, -2) '±N¸ê®Æ¦s¤J¦r¨å
a.Offset(, -1) = a.Value & "1-" & a.Value & a.Offset(, -2) '±N½d³ò¸ê®Æ¶ñ¤JÀx¦s®æ
Else '¦r¨å¤¤§ä¨ì¸ê®Æ
a.Offset(, -1) = a.Value & d(a.Value) + 1 & "-" & a.Value & a.Offset(, -2) + d(a.Value) '±N½d³ò¸ê®Æ¶ñ¤JÀx¦s®æ
d(a.Value) = a.Offset(, -2) + d(a.Value) '§ó·s¦r¨å¸ê®Æ
End If
Next
Set d = Nothing
End Sub