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

[µo°Ý] Àµ½Ð°ª¤â±Ð¾Ç

[µo°Ý] Àµ½Ð°ª¤â±Ð¾Ç

¦U¦ì¾Çªø¦n
¤p§Ì¦³¤@¨Æ·Q½Ð±Ð
¦b»s¯¸§O©ú²Óªí-Âà´«.zip (111.78 KB)
¦pÀɮפº®e
¤p§Ì¤w¸g¼g¦n¡A¨Ï¥Î¦h°j°é¤è¦¡
±N¤À­¶(­ì©lÀÉ®×)ªº¤å¦r
¦æ¦CÂà´«¨Ã¶K¨ì¤À­¶(Âà´«µ²ªG)
¦ý¦³°ÝÃDªº¬O
1.®Æ¸¹»sµ{¦X­p: ªº¦WºÙ °j°é§ÚÁפ£±¼¡A¥²¶·­n¥Î¥t¥~ªº¤è¦¡ §R°£¡C
2.¥Ø«eªº¼gªk Äæ¦ì¦pªG¨S¦³¶W¹LEÄæ¦ì  °j°é´N·|¥d¦í(µL­­½ü°j)¡C
3.©Ó¤W!¸ê®Æ±q¨t²Î¤¤­Ë¥X¨Óªº¥u·|Åã¥Ü¨ìEÄæ¦ì¡C
4.½Ð°Ý¤@¤UVBA ¦³¦Û°Ê ¼Ï¯ÃÅܧó½d³òªº¤è¦¡¶Ü?? ¸ê®Æ§ó·s¤§«á ¼Ï¯Ã·|ÅÜ ­n¤â°Ê­«·s§ó·s½d³ò¡A§Ú¥Î¿ý»s¥¨¶°¤Î¤Wºô§ä¹L ³£¬Ý¤£À´
¥H¤W !!Áٽнç±Ð!!
ÁÂÁÂ!!

Sub Âà´«()
Dim Arr, Brr, i&, j%, R&, T1$, T2$, N&
Arr = Sheets("­ì©lÀÉ®×").UsedRange
ReDim Brr(1 To 50000, 1 To 4)
For i = 1 To UBound(Arr)
    If Arr(i, 1) = "®Æ¥ó½s¸¹" Then R = i: GoTo i01
    If Not Arr(i, 4) Like "JM##-#########" Then GoTo i01
    For j = 5 To UBound(Arr, 2)
        If Val(Arr(i, j)) = 0 Then GoTo j01
        N = N + 1
        Brr(N, 1) = Arr(i, 1): Brr(N, 2) = Arr(i, 4)
        Brr(N, 3) = Arr(R, j): Brr(N, 4) = Arr(i, j)
j01: Next j
i01: Next i
Call ²M°£: If N = 0 Then Exit Sub
[Âà´«µ²ªG!A2].Resize(N, 4) = Brr
[Âà´«µ²ªG!A1].Resize(N + 1, 4).Name = "My_Data"
End Sub


Sub ²M°£()
With Sheets("Âà´«µ²ªG")
     If .AutoFilterMode Then .AutoFilterMode = False
     .UsedRange.Offset(1, 0).EntireRow.Delete
End With
End Sub


Xl0000001.rar (52.78 KB)

Âà´«µ²ªGªº¸ê®Æ°Ï(§t¼ÐÃD), ©w¸q¬°"My_Data",
¼Ï¯Ã¤ÀªRªí¥u­n¨Ï¥Î³o­Ó¦WºÙ·í¨Ó·½, ¤â°Ê§ó·s§Y¥i!

===============================

TOP

¦^´_ 2# ­ã´£³¡ªL
·PÁÂ!!­ã¤j
°j°é¦nµu!!¦n¼F®`!!

TOP

¦^´_ 2# ­ã´£³¡ªL


    ÁÂÁ½׾Â,ÁÂÁ«e½ú«ü¾É
«á¾ÇÂǦ¹©«¾Ç²ß«e½úªº¤è®×,¾Ç²ß¤ß±oµù¸Ñ¦p¤U,½Ð«e½ú¦A«ü¾É

¸ê®Æªí:


°õ¦æµ²ªG:


¯Ç¤J¦WºÙ:



Sub Âà´«()
Dim Arr, Brr, i&, R&, N&, j%, T1$, T2$
'¡ô«Å§iÅܼÆ:(Arr,Brr)³q¥Î«¬ÅܼÆ,(i,R,N)ªø¾ã¼Æ,jµu¾ã¼Æ,(T1,T2)¦r¦êÅܼÆ
Arr = Sheets("­ì©lÀÉ®×").UsedRange
'¡ô¥OArrÅܼƬO¸Ë¤J "­ì©lÀÉ®×"¤u§@ªí¦³¨Ï¥ÎÀx¦s®æ­Èªº¤Gºû°}¦C
ReDim Brr(1 To 50000, 1 To 4)
'¡ô«Å§iBrr¬O¤GºûªÅ°}¦C,Áa¦V¯Á¤Þ¸¹(1~500000),¾î¦V¯Á¤Þ¸¹(1~4)
For i = 1 To UBound(Arr)
'¡ô³]¶¶°j°é!i±q1 ¨ìArr°}¦CÁa¦V³Ì¤j¯Á¤Þ¦C¸¹
    If Arr(i, 1) = "®Æ¥ó½s¸¹" Then R = i: GoTo i01
    '¡ô¦pªGi°j°é¦C1ÄæArr°}¦C­È¬O "®Æ¥ó½s¸¹"¦r¦ê?
    'True´N¥ORÅܼƦPiÅÜ¼Æ­È (³o¬O­n°O¿ý¨C­Ó¬q¸¨ªº¤u§@¯¸¦WºÙ©Ò¦bªº¦C¸¹)
    '³Ì«á¸õ¨ì¼Ð¥Ü i01¦ì¸mÄ~Äò°õ¦æ

    If Not Arr(i, 4) Like "JM##-#########" Then GoTo i01
    '¡ô¦pªGi°j°é¦C4ÄæArr°}¦C­È¤£¬O "JM##-#########"³W«hªº¦r¦ê?
    'True´N¸õ¨ì¼Ð¥Ü i01¦ì¸mÄ~Äò°õ¦æ

    For j = 5 To UBound(Arr, 2)
    '¡ô³]¶¶°j°é!j±q5 ¨ìArr°}¦C¾î¦V³Ì¤j¯Á¤ÞÄ渹
        If Val(Arr(i, j)) = 0 Then GoTo j01
        '¡ô¦pªGi°j°é¦Cj°j°éÄæArr°}¦C­ÈÂনªº¼Æ­È¬O 0,´N¸õ¨ì¼Ð¥Ü j01¦ì¸mÄ~Äò°õ¦æ
        N = N + 1
        '¡ô¥ONÅܼƲ֥[1 (¼g¤J¸ê®Æªº¯Á¤Þ¦C¸¹)
        Brr(N, 1) = Arr(i, 1): Brr(N, 2) = Arr(i, 4)
        Brr(N, 3) = Arr(R, j): Brr(N, 4) = Arr(i, j)
        '¡ô¥OArr°}¦C¸ê®Æ ¼g¤JBrr°}¦C¤¤
j01: Next j
i01: Next i
Call ²M°£: If N = 0 Then Exit Sub
'¡ô°õ¦æ°Æµ{¦¡ Sub ²M°£()
'¦pªGNÅܼƬO0 (¥NªíNÅܼƬO©Ò«Å§iªºªø¾ã¼Æªì©l­È 0),´Nµ²§ôµ{¦¡°õ¦æ
[Âà´«µ²ªG!A2].Resize(N, 4) = Brr
'¡ô±NBrr°}¦C­È¼g¤JÀx¦s®æ¤¤
[Âà´«µ²ªG!A1].Resize(N + 1, 4).Name = "My_Data"
'¡ô¥O«ü©w½d³òÀx¦s®æ¥H "My_Data" ¦r¦ê¬°¦W,¯Ç¤J¦WºÙ¤¤
End Sub

Sub ²M°£()
With Sheets("Âà´«µ²ªG")
     If .AutoFilterMode Then .AutoFilterMode = False
     '¡ô¦pªG¦³¦Û°Ê¿z¿ï¥\¯à? True´N¥O¿z¿ï¥\¯àÃö³¬
     https://learn.microsoft.com/zh-t ... heet.autofiltermode
     .UsedRange.Offset(1, 0).EntireRow.Delete
     '¡ô¥O°£¤F¼ÐÃD¦C¥H¥~ªº¤w¨Ï¥ÎÀx¦s®æ§R°£
End With
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : ¦h°µ¦h±o¡C¤Ö°µ¦h¥¢¡C
ªð¦^¦Cªí ¤W¤@¥DÃD