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

¶K¤J»s³y¸¹½X«á¦Û°Ê©óG2²£¥Í¶ñº¡®ÄªG

¶K¤J»s³y¸¹½X«á¦Û°Ê©óG2²£¥Í¶ñº¡®ÄªG

½Ð°Ý¤@¤U
¶K¤J»s³y¸¹½X«á¦Û°Ê©óG2²£¥Í¶ñº¡®ÄªG
10005874-1-6
©óG2¦Û°Ê²£¥Í
10005874-1
10005874-2
10005874-3
10005874-4
10005874-5
10005874-6
¬O¥Î¨ç¼ÆÁÙ¬O¥¨¶°¤~¥i¥H©O
¦pªþ¥ó
½ÐÀ°¦£~~~
ÁÂÁÂ

¶K¤J«á¦Û°Ê©óG2²£¥Í¶ñº¡®ÄªG.rar (1.95 KB)

  1. Sub getmynumber()
  2. Dim Ay(), A As Range, Ar As Variant, s&, i%
  3. For Each A In Range([C2], [C65536].End(xlUp))
  4.    If Len(A) - Len(Replace(A, "-", "")) = 2 Then
  5.    Ar = Split(A, "-")
  6.    For i = Val(Ar(1)) To Val(Ar(2))
  7.       ReDim Preserve Ay(s)
  8.       Ay(s) = Ar(0) & "-" & i
  9.       s = s + 1
  10.    Next
  11.    Else
  12.       ReDim Preserve Ay(s)
  13.       Ay(s) = A
  14.       s = s + 1
  15.    End If
  16. Next
  17. [G2:G65536] = ""
  18. [G2].Resize(s, 1) = Application.Transpose(Ay)
  19. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh


dear Hsieh
ÁÂÁ§A³á~~
¯uªº¥i¥H­C
^^

TOP

Åv­­¤£¨¬¡AµLªk¤U¸ü§AªºÀɮסA©Ò¥H¼È®É°²©w§Aªº»s³y¸¹½X¶K¦b[G1]®æ¤º¡A¨º»ò¥u­n¦b[G2]®æ¤º¿é¤J¤U¦C¤½¦¡¡A¦A©ì¦²½Æ»s¦Ü©Ò»Ý¦C¼Æ§Y¥i....²Â¤èªk¡A½Ð«ü±Ð..
=IF(--(ROWS($2:2)+MID($G$1,FIND("-",$G$1)+1,FIND("-",$G$1,FIND("-",$G$1)+1)-FIND("-",$G$1)-1)-1)<=--RIGHT($G$1,LEN($G$1)-FIND("-",$G$1,FIND("-",$G$1)+1)),LEFT($G$1,FIND("-",$G$1)-1)&"-"&(ROWS($2:2)+MID($G$1,FIND("-",$G$1)+1,FIND("-",$G$1,FIND("-",$G$1)+1)-FIND("-",$G$1)-1)-1),"")

TOP

¦^´_ 2# Hsieh

½Ð°Ý§A
¦pªG¬O
«È¤á         ¤Ø¤o     »s³y¸¹½X            BP¼Æ
AAA        110*550        1009564-1         2
BBB        333*545        01006505-1-2        4
¥i¥HÂà´«¦¨¦p¤U¡ABP¼Æ 2 Âà´«¦¨2¤ñ¦P¼Ë¸¹½X¡A¦ý¬O«á­±·|¥HA~B°Ï¤À~~BP¼Æ 4      ·|  A~B~C~D °Ï¤À              
AAA        110*550        1009564-1A
AAA        110*550        1009564-1B
BBB        333*545        01006505-1A
BBB        333*545        01006505-1B
BBB        333*545        01006505-1C
BBB        333*545        01006505-1D
BBB        333*545        01006505-2A
BBB        333*545        01006505-2B
BBB        333*545        01006505-2C
BBB        333*545        01006505-2D

³o¼Ë¤]¥i¥H¶Ü
¦A¦¸³Â·Ð©p¤F
ÁÂÁÂ

¶K¤J«á¦Û°Ê©óG2²£¥Í¶ñº¡®ÄªG.rar (8.26 KB)

TOP

¦^´_ 5# ÅQ®ð¨«¥þ¨­
  1. Sub SSS()
  2. Dim Ay(), A As Range, Ar As Variant, s&, i%
  3. For Each A In Range([D2], [D65536].End(xlUp))
  4.    If Len(A) - Len(Replace(A, "-", "")) = 2 Then
  5.    Ar = Split(A, "-")
  6.    For i = Val(Ar(1)) To Val(Ar(2))
  7.    For j = 1 To A.Offset(, 1)
  8.    If A.Offset(, 1) > 1 Then temp = Chr(64 + j) Else temp = ""
  9.       ReDim Preserve Ay(s)
  10.       Ay(s) = Array(A.Offset(, -2).Value, A.Offset(, -1).Value, Ar(0) & "-" & i & temp)
  11.       s = s + 1
  12.    Next
  13.    Next
  14.    Else
  15.    For j = 1 To A.Offset(, 1)
  16.    If A.Offset(, 1) > 1 Then temp = Chr(64 + j) Else temp = ""
  17.       ReDim Preserve Ay(s)
  18.       Ay(s) = Array(A.Offset(, -2).Value, A.Offset(, -1).Value, A.Value & temp)
  19.       s = s + 1
  20.    Next
  21.    End If
  22. Next
  23. [K2:M65536] = ""
  24. [K2].Resize(s, 3) = Application.Transpose(Application.Transpose(Ay))
  25. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¼Ó¥D1¼Ó
  1. Sub abc()
  2. Dim head(), body(), tail(), mycell As Range, i As Integer, j As Integer, k As Integer
  3. For Each mycell In Range([c2], [c65536].End(xlUp))
  4. ReDim Preserve head(i)
  5. ReDim Preserve body(i)
  6. ReDim Preserve tail(i)
  7. head(i) = Split(mycell, "-")(0)
  8. body(i) = Split(mycell, "-")(1)
  9. tail(i) = Split(mycell, "-")(2)
  10. i = i + 1
  11. Next

  12. Range("h2").Activate

  13. For j = 0 To UBound(head)
  14. For k = body(j) To tail(j)
  15. ActiveCell.Value = head(j) & "-" & k
  16. ActiveCell.Offset(1).Activate
  17. Next
  18. Next

  19. End Sub
½Æ»s¥N½X
¼Ó¥D5¼Ó
  1. Sub myprint()
  2. Dim mycell As Range, head(), body(), tail(), BPnumber(), i As Integer
  3. Dim j As Integer, bp As Integer, k As Integer, l As Integer

  4. For Each mycell In Range([d2], [d65536].End(xlUp))
  5. ReDim Preserve head(i)
  6. ReDim Preserve body(i)
  7. ReDim Preserve tail(i)
  8. ReDim Preserve BPnumber(i)
  9. head(i) = Split(mycell, "-")(0)
  10. body(i) = Split(mycell, "-")(1)
  11.     If UBound(Split(mycell, "-")) = 2 Then
  12.     tail(i) = Split(mycell, "-")(2)
  13.     Else
  14.     tail(i) = ""
  15.     End If
  16. BPnumber(i) = mycell.Offset(, 1).Value
  17. i = i + 1
  18. Next

  19. Range("L2").Activate

  20. For j = 0 To UBound(head)
  21.     If tail(j) = "" Then
  22.         If BPnumber(j) = 1 Then
  23.         ActiveCell = Cells(j + 2, 2).Value
  24.         ActiveCell.Offset(, 1) = Cells(j + 2, 2).Offset(, 1).Value
  25.         ActiveCell.Offset(, 2) = head(j) & "-" & body(j)
  26.         ActiveCell.Offset(1).Activate
  27.         Else
  28.             For bp = 1 To BPnumber(j)
  29.                 ActiveCell = Cells(j + 2, 2).Value
  30.                 ActiveCell.Offset(, 1) = Cells(j + 2, 2).Offset(, 1).Value
  31.                 ActiveCell.Offset(, 2) = head(j) & "-" & body(j) & Chr(64 + bp)
  32.                 ActiveCell.Offset(1).Activate
  33.             Next
  34.         End If
  35.     Else
  36.         If BPnumber(j) = 1 Then
  37.             For k = body(j) To tail(j)
  38.                 ActiveCell = Cells(j + 2, 2).Value
  39.                 ActiveCell.Offset(, 1) = Cells(j + 2, 2).Offset(, 1).Value
  40.                 ActiveCell.Offset(, 2) = head(j) & "-" & k
  41.                 ActiveCell.Offset(1).Activate
  42.             Next
  43.         Else
  44.             For k = body(j) To tail(j)
  45.                 For bp = 1 To BPnumber(j)
  46.                  ActiveCell = Cells(j + 2, 2).Value
  47.                  ActiveCell.Offset(, 1) = Cells(j + 2, 2).Offset(, 1).Value
  48.                  ActiveCell.Offset(, 2) = head(j) & "-" & k & Chr(64 + bp)
  49.                  ActiveCell.Offset(1).Activate
  50.                  Next
  51.             Next
  52.         End If
  53.     End If
  54. Next

  55. End Sub
½Æ»s¥N½X
¤gªk¤j·Ò¿û,¤ñ¸ûÁc½Æ©MºC¤@ÂI
¥t¥~5¼ÓªþÀÉD7¤@Äæ,³Ì¥k¤â­±¦³¦h¾lªÅ®æ,·|¼vÅTµ²ªG,­n¤p¤ß³B²z
80 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¯Ê¤fªºªM¤l¡A¦pªG´«¤@­Ó¨¤«×¬Ý¥¦¡A¥¦¤´µM¬O¶êªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD