| ©«¤l2035 ¥DÃD24 ºëµØ0 ¿n¤À2031 ÂI¦W0  §@·~¨t²ÎWin7 ³nÅ骩¥»Office2010 ¾\ŪÅv100 ©Ê§O¨k µù¥U®É¶¡2012-3-22 ³Ì«áµn¿ý2024-2-1 
 | 
                
| ¥»©«³Ì«á¥Ñ c_c_lai ©ó 2016-12-12 19:17 ½s¿è 
 ¦^´_ 10# starbox520
 ¨S¿ù¡I
 ¨Ï¥Î²Ä¤GºØ¤èªk (ReDim Preserve)¡AÁö¨ü©ó Application.Transpose() 255 ªº¨î¡A
 ¦ý¥¦¯à±o¥H°ÊºAªº¼W¥[°}¦C¡A¬O¥¦ªºÀuÂI¡C¦ý¬O¥Ñ©ó©p²{¦³ªº®×¨Ò«o¤£¤Ó¾A¦X¡A¬O¬G§ï±Ä
 ¤@¦¸ª½±µ«Å§i°}¦C¤j¤pªº²Ä¤@ºØ¤èªk (ReDim ar())¡A¦Ó±N°}¦Cª½±µ²¾Âà (Assign) ¨ì¤u§@ªí³æ¤º¡C
 ¤£P¨ü©ó Transpose() ªø«×ªº¨î¡C
 ½Æ»s¥N½XSub Ex()
    Dim ln As Variant, ar As Variant
    Dim cts As Integer, ct2 As Integer
    
    With Sheets("Data")
        ln = .[A1].CurrentRegion.Value      '  Ln :  : Variant/Variant(1 to 177, 1 to 35)
        '  UBound(Ln, 1) = 177 : Long   /   UBound(Ln, 2) : 35 : Long
        ReDim ar(1 To UBound(ln, 2) + 1, 1 To 2)
        For cts = 1 To UBound(ln, 2) - 5
            ar(cts, 1) = ln(1, cts + 1)  
            ar(cts, 2) = ""
            For ct2 = 3 To UBound(ln, 1)
                 If ln(ct2, cts + 1) <> 0 Then
                    ar(cts, 2) = IIf(ar(cts, 2) = "", ln(ct2, 1) & IIf(ln(ct2, cts + 1) > 0, "+", "") & ln(ct2, cts + 1), _
                                        ar(cts, 2) & "," & ln(ct2, 1) & IIf(ln(ct2, cts + 1) > 0, "+", "") & ln(ct2, cts + 1))
                End If
            Next ct2
        Next cts
    End With
        
    With Sheets("TEST")
        .[H:I] = ""
        .[H2].Resize(UBound(ar, 1), UBound(ar, 2)) = ar
    End With
End Sub
 scanttt2.rar (31.82 KB) | 
 |