ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¦Û°Ê½s¸¹°ÝÃD

¦Û°Ê½s¸¹°ÝÃD

Book1.rar (8.51 KB) ¦U¦ì¥ý¶i­Ì¦n¡I
ÁöµM¥i¥H¨Ï¥Î¨ç¼Æ§¹¦¨BÄæ¦ìªº¦Û°Ê½s½X¡A
¦ý½Ð¥ý¶i­Ì¥i§_¥ÎVBAµ{¦¡¨Ó°õ¦æ¡C
®×¸¹                   ®×¦¸
RM960101        RM960101-1
RM960101        RM960101-2
RM960102        RM960102-1
RM960103        RM960103-1
RM960103        RM960103-2
RM960104        RM960104-1
RM960105        RM960105-1
RM960105        RM960105-2

  1. Sub yy()
  2. Dim d As Object, rng, i%
  3. Set d = CreateObject("Scripting.Dictionary")
  4. rng = Range([a2], "b" & [a65536].End(3).Row)
  5. For i = 1 To UBound(rng)
  6. d(rng(i, 1)) = d(rng(i, 1)) + 1
  7. rng(i, 2) = rng(i, 1) & "-" & d(rng(i, 1))
  8. Next
  9. [b2].Resize(i - 1, 1) = Application.Index(rng, , 2)
  10. End Sub
½Æ»s¥N½X

TOP

·PÁ±zªº¨ó§U¡A
¤£¹L¦³´X­Ó°ÝÃD·Q¸ß°Ý¤@¤U
1.¥i¥H¥u³]©w¤u§@ªíSheet1¦Û¤v¦Û°Ê°õ¦æ¶Ü¡H
2.¦³¥i¯àÅýaÄæ¦ì¦³ÅܰʮɦA½Õ¾ã¶Ü¡H¨Ò¦pa4¦³¸ê®Æ¿é¤Jb4¤~·|°õ¦æ¡A¤£¥ÎÅý¥þ³¡ªºÄæ¦ì³£­«·s¶]¹L¡C

TOP

°µ¦¨Worksheet_Change¨Æ¥ó§Y¥i¡C

TOP

ÁÂÁ±zªº«Øij
¤w¸gµ{¦¡²¤½Õ¾ã¦¨
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim d As Object, rng, i%
Set d = CreateObject("Scripting.Dictionary")
rng = Range([a2], "b" & [a65536].End(3).Row)
For i = 1 To UBound(rng)
d(rng(i, 1)) = d(rng(i, 1)) + 1
rng(i, 2) = rng(i, 1) & "-" & d(rng(i, 1))
Next
[b2].Resize(i - 1, 1) = Application.Index(rng, , 2)

End Sub
¥Ø«e´ú¸Õok
ÁÂÁ±zªºÀ°¦£

TOP

¥Ø«e´ú¸Õok¡H
³o¼ËÁÙ¤£¬O¥þ³¡Äæ¦ì­«¶]¤@¹M¡H

TOP

        ÀR«ä¦Û¦b : °µ¦n¨Æ¤£¯à¤Ö§Ú¤@¤H¡A°µÃa¨Æ¤£¯à¦h§Ú¤@¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD