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

[µo°Ý] ±a¥X«DªÅ¥Õ¸ê®Æ

[µo°Ý] ±a¥X«DªÅ¥Õ¸ê®Æ

«e½ú­Ì¦n,

J:ACÄæ¬O½c¸¹
J:ACÄæ­Y¥þªÅ¥Õ,«hADÄæ=ªÅ¥Õ

½Ð±Ð«e½ú,ADÄæ­n¦p¦ó¹F¦¨
±a¥XJ:ACÄæ,©Ò¦³«DªÅ¥Õªº¸ê®Æ,¤¤¶¡¥H","¹j¶}
±a¥X«DªÅ¥Õ¸ê®Æ.rar (93.1 KB)

¦^´_ 1# PJChen


    ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú,ÁÂÁ«e½úµoªí¦¹¥DÃD»P½d¨Ò
«á¾ÇÂǦ¹©«½m²ß°}¦C,¾Ç²ß¤è®×¦p¤U,½Ð«e½ú°Ñ¦Ò

°õ¦æ«e:


°õ¦æµ²ªG:



Option Explicit
Sub TEST()
Dim Brr, i&, j&, T$, xR As Range, Sh As Worksheet
Set Sh = Sheets("mark")
Set xR = Intersect(Sh.[J:AD], Sh.[J1].CurrentRegion)
Intersect(xR.Offset(1, 0), [AD:AD]).ClearContents: Brr = xR
For i = 2 To UBound(Brr)
   T = Brr(i, 21)
   For j = 1 To UBound(Brr, 2) - 1
      T = Replace(Replace(T & "," & Brr(i, j) & ",", ",,", ","), ",,", ",")
   Next
   Brr(i, 21) = Mid(Left(T, Len(T) - 1), 2)
Next
xR.NumberFormatLocal = "@": xR = Brr
Set xR = Nothing: Set Sh = Nothing: Erase Brr
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 2# Andy2483

±z¦n,
§Ú¤W¶ÇªºÀÉ®×,¬°¤F¨ÏÀɮפ£­nªÎ¤j,©Ò¥H§â¤½¦¡³£­È¤Æ¤F,°õ¦æµ{¦¡«á,«Ü¦h¤½¦¡³£Åܦ¨­È,
±z¯à§_­×§ïµ{¦¡,¤£­n±NÀx¦s®æ­È¤Æ¡H
·PÁ±z

TOP

¦^´_ 3# PJChen


    ÁÂÁ«e½ú¦^´_
«á¾ÇÂǦ¹©«¦b½m²ß¦b¦P¤@°}¦C¸Ìµ²ªG­È»\±¼­ì°}¦C­È,¨ú¥X³¡¤À°}¦C­È¶K¤J¥Ø¼Ð®æ

Option Explicit
Sub TEST()
Dim Brr, i&, j&, T$, T1$, xR As Range, Sh As Worksheet
Set Sh = Sheets("mark")
Set xR = Intersect(Sh.[J:AD], Sh.[J1].CurrentRegion.Offset(1, 0))
Intersect(xR.Offset(1, 0), [AD:AD]).ClearContents
Brr = xR
For i = 1 To UBound(Brr) - 1
   For j = 1 To UBound(Brr, 2) - 1
      T = Brr(i, j)
      T1 = Replace(Replace(T1 & "," & T & ",", ",,", ","), ",,", ",")
   Next
   Brr(i, 1) = Mid(Left(T1, Len(T1) - 1), 2): T1 = ""
Next
With Intersect(Intersect(xR, [AD:AD]), Sh.[J1].CurrentRegion)
   .Value = Brr: .Select
End With
Set xR = Nothing: Set Sh = Nothing: Erase Brr
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 3# PJChen


    ¦A¦¸ÁÂÁ«e½úµoªí¦¹¥DÃD,ÁÂÁ½׾Â
«á¾Ç½Æ²ßµ{¦¡½X°µ¤ß±oµù¸Ñ,½Ð«e½ú°Ñ¦Ò,½Ð¦U¦ì«e½ú«ü±Ð

,Option Explicit
Sub TEST()
Dim Brr, i&, j&, T$, T1$, xR As Range, Sh As Worksheet
'¡ô«Å§iÅܼÆ:Brr¬O³q¥Î«¬ÅܼÆ,(i,j)¬Oªø¾ã¼Æ,(T,T1)¬O¦r¦êÅܼÆ,
'xR¬OÀx¦s®æÅܼÆ,Sh¬O¤u§@ªíÅܼÆ

Set Sh = Sheets("mark")
'¡ô¥OSh³o¤u§@ªíÅܼƬO¦W¬° "mark"ªº¤u§@ªí
Set xR = Intersect(Sh.[J:AD], Sh.[J1].CurrentRegion.Offset(1, 0))
'¡ô¥OxR³oÀx¦s®æÅܼƬO ¨â­Ó½d³òÀx¦s®æ¥æ¶°ªº½d³òÀx¦s®æ
'½d³ò1:"mark"¤u§@ªíªºJÄæ¨ìADÄ椧¶¡ªº©Ò¦³Àx¦s®æ
'½d³ò2:"mark"¤u§@ªíªº[J1]Àx¦s®æ¬Û¾F¦ê±µÀx¦s®æÂX®i³Ì¤p¤è¥¿½d³òªºÀx¦s®æ

Intersect(xR.Offset(1, 0), [AD:AD]).ClearContents
'¡ô¥O¨â­Ó½d³òÀx¦s®æ¥æ¶°ªº½d³òÀx¦s®æ²M°£¨ä¤º®e
'½d³ò1:xRÅܼƦV¤U°¾²¾¤@¦Cªº½d³òÀx¦s®æ
'½d³ò2:ADÄæ¥þ³¡ªºÀx¦s®æ

Brr = xR
'¡ô¥OBrr³o³q¥Î«¬ÅܼƬO ¤Gºû°}¦C,¥O¥HxRÅܼƭÈ(Àx¦s®æ­È)±a¤J°}¦C
For i = 1 To UBound(Brr) - 1
'¡ô³]¶¶°j°é!i±q 1¨ì Brr°}¦CÁa¦V²Ä2¤j¯Á¤Þ¦C¸¹
   For j = 1 To UBound(Brr, 2) - 1
   '¡ô³]¶¶°j°é!j±q 1¨ì Brr°}¦C¾î¦V²Ä2¤j¯Á¤ÞÄ渹
      T = Brr(i, j)
      '¡ô¥OT³o¦r¦êÅܼƬO i°j°é¦C²Äj°j°éÄ檺Brr°}¦C­È
      T1 = Replace(Replace(T1 & "," & T & ",", ",,", ","), ",,", ",")
      '¡ô¥OT1³o¦r¦êÅܼƬO T1ÅܼƳs±µ³r¸¹,¦A³s±µTÅܼÆ,
      '¦A³s±µ³r¸¹²Õ¦¨ªº·s¦r¦ê,³Ì«á¸g¹L¨â¦¸¦r¦ê¸m´««áªº¥þ·s¦r¦ê
      '²Ä1¦¸¦r¦ê¸m´«¬O±N¦r¦ê¸Ìªº",,"Âù³r¸¹¸m´«¦¨","1­Ó³r¸¹
      '²Ä2¦¸¦r¦ê¸m´«¤]¬O±N¦r¦ê¸Ìªº",,"Âù³r¸¹¸m´«¦¨","1­Ó³r¸¹

   Next
   Brr(i, 1) = Mid(Left(T1, Len(T1) - 1), 2): T1 = ""
   '¡ô¥Oi°j°é¦C²Ä1ÄæBrr°}¦C­È¬O Â_±ËÂ÷¤§«á³Ñ¤Uªº¦r¦ê
   '¥ýT1ÅܼƦr¦ê¨ú¥ª°¼ªº¦r¤¸,³Ì¥kÃ䪺¦r¤£¨ú,
   '¤§«á¦A¨ú¥kÃ䪺¦r¤¸,³Ì¥ªÃ䪺¦r¤£¨ú,
   'PS:´N¬O³Ì¥ª³Ì¥kªº³o¨â­Ó¦r¤¸¤£­n,¨ú¤¤¶¡ªº¦r¦ê

Next
With Intersect(Intersect(xR, [AD:AD]), Sh.[J1].CurrentRegion)
'¡ô¥H¤U¬OÃö©ó¨â¦¸Àx¦s®æ½d³ò¥æ¶°«áÀx¦s®æªºµ{§Ç
   .Value = Brr: .Select
   '¡ô¥O¨äÀx¦s®æ­È¬O Brr°}¦C­È,Brr°}¦C¶W¹L¸ÓÀx¦s®æ½d³òªº­È¤£¥Î¥¦
End With
Set xR = Nothing: Set Sh = Nothing: Erase Brr
'¡ô¥OÄÀ©ñÅܼÆ
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 5# Andy2483

·PÁ±zªº¸Ñ»¡

TOP

¼Æ¾Ú·½À³ÁקK¥Îµ{¦¡Âл\¤@¦¸, ¥u¦C¥Xµ²ªG¦ì¸m§Y¥i~~
­Y¸ê®Æ¦h¥BÄæ¦ì¦h, ¾ã­Ó­«·s¶K¤W´N·|©ìºC³t«×.

Sub TEST_A1()
Dim Arr, T$, i&, j%
Arr = Range("J1:AC" & Cells(Rows.Count, 1).End(3).Row)
For i = 2 To UBound(Arr)
    For j = 1 To UBound(Arr, 2)
        T = Trim(T & " " & Trim(Arr(i, j)))
    Next j
    Arr(i - 1, 1) = Replace(T, " ", ","): T = ""
Next i
With [ad2].Resize(UBound(Arr) - 1)
     .NumberFormatLocal = "@"
     .Value = Arr
End With
End Sub

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-4-24 10:51 ½s¿è

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


    ÁÂÁ½׾Â,ÁÂÁ«e½ú«ü¾É
«á¾Ç¾Ç²ß¤ß±oµù¸Ñ¦p¤U,½Ð«e½ú¦A«ü¾É

Option Explicit
Sub TEST_A1()
Dim Arr, T$, i&, j%
'¡ô«Å§iÅܼÆ:Arr¬O³q¥Î«¬ÅܼÆ,T¬O¦r¦êÅܼÆ,i¬Oªø¾ã¼Æ,j¬Oµu¾ã¼Æ
Arr = Range("J1:AC" & Cells(Rows.Count, 1).End(3).Row)
'¡ô¥OArr³o³q¥Î«¬ÅܼƬO ¤Gºû°}¦C,¥H[J1]¨ìACÄæ³Ì«á¤@­Ó¦³¤º®eÀx¦s®æ­È±a¤J
For i = 2 To UBound(Arr)
'¡ô³]¶¶°j°é!i±q2 ¨ìArr°}¦CÁa¦V³Ì¤j¯Á¤Þ¦C¸¹
    For j = 1 To UBound(Arr, 2)
    '¡ô³]¶¶°j°é!j±q1 ¨ìArr°}¦C¾î¦V³Ì¤j¯Á¤ÞÄ渹
        T = Trim(T & " " & Trim(Arr(i, j)))
        '¡ô¥OT³o¦r¦êÅܼƬO TÅܼƳs±µªÅ¥Õ¦r¤¸,
        '¦A³s±µ¥hÀY§ÀªÅ¥Õ¦r¤¸ªºi°j°é¦Cj°j°éÄæArr°}¦C­È©Ò²Õ¦¨ªº·s¦r¦ê
        '³Ì«á¦A¥h°£ÀY§ÀªºªÅ¥Õ¦r¤¸

    Next j
    Arr(i - 1, 1) = Replace(T, " ", ","): T = ""
    '¡ô¥O(iÅܼÆ-1)¦C²Ä1ÄæArr°}¦C­È¬O TÅܼƱNªÅ¥Õ¦r¤¸¸m´«¬°³r¸¹«áªº¦r¦ê,
    '¥OTÅܼƬOªÅ¦r¤¸,³o¼Ëªº¤è¦¡¥i¥HÅý¦r¦ê³Ì«e¤è»P«á¤è¤£·|¦h¤@­Ó³r¸¹

Next i
With [ad2].Resize(UBound(Arr) - 1)
'¡ô¥H¤U¬OÃö©ó[AD2]Àx¦s®æÂX®i¦V¤U(Arr°}¦CÁa¦V¯Á¤Þ¸¹-1)­ÓÀx¦s®æªºµ{§Ç
     .NumberFormatLocal = "@"
     '¡ô¥O¸Ó°Ï°ìÀx¦s®æ®æ¦¡¬O¤å¦r
     .Value = Arr
     '¡ô¥O¸Ó°Ï°ìÀx¦s®æ­È¥HArr°}¦C­È±a¤J
End With
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : ­×¦æ­nô½t­×¤ß¡AÂǨƽm¤ß¡AÀH³B¾i¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD