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

[µo°Ý] Application.Transpose() ¥i¥H³B²z¸ê®ÆÂà¸mªº°}¦Cªø«× ?

[µo°Ý] Application.Transpose() ¥i¥H³B²z¸ê®ÆÂà¸mªº°}¦Cªø«× ?

½Ð±Ð¥ý¶i

¤U¦Cµ{¦¡°õ¦æ®ÉÅã¥Ü Ãþ§O¤£¦X ¿ù»~

sub ex()
     Dim Arr()
     Dim NumOfRow as Long      
'°²¦p NumOfRow ¶W¥X 2^16 (=65536)¡A¨ú¤J¸ê®ÆÂà¸m¡A¤U¤@µ{¦¡½X°õ¦æ®É´NÅã¥Ü¿ù»~
      Arr = Application.Transpose(Range("A2").resize(NumOfRow,1).value)
End sub

Excel ª©¥» 2010
¤u§@ªí¤º¸ê®Æ¶W¹L10¸Uµ§¡A¦p¤£¥þ³¡¥H For ....   Next ¤èªk¡A¦p¦ó§â¸ê®Æ§Ö³t¥þ³¡¨ú¤J°}¦C¨Ó³B²z¡A¦A¥H°}¦C¦^¸mµ¹¤u§@ªí?

¦^´_ 1# Scott090
½T¹êtranspose¦³°}¦C¤j¤p­­¨î¡A
¥i¥H¦Û¤v¼gÂà¸mªºFunction:
  1. Function MyTranspose(arInput)
  2.   Dim i As Long, j As Long
  3.   Dim arRetn
  4.   
  5.   If LBound(arInput) <> 1 Or LBound(arInput, 2) <> 1 Then Err.Raise vbObjectError + 9999, , "The low bound of input array should be 1."
  6.   
  7.   If UBound(arInput) <= 65536 And UBound(arInput, 2) <= 65536 Then
  8.     MyTranspose = Application.Transpose(arInput)
  9.   Else
  10.     If UBound(arInput, 2) = 1 Then
  11.       ReDim arRetn(1 To UBound(arInput))
  12.       For i = 1 To UBound(arInput)
  13.         arRetn(i) = arInput(i, 1)
  14.       Next
  15.     Else
  16.       ReDim arRetn(1 To UBound(arInput, 2), 1 To UBound(arInput))
  17.       For i = 1 To UBound(arInput)
  18.         For j = 1 To UBound(arInput, 2)
  19.           arRetn(j, i) = arInput(i, j)
  20.         Next
  21.       Next
  22.     End If
  23.     MyTranspose = arRetn
  24.   End If
  25. End Function
½Æ»s¥N½X
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 2# stillfish00


    «D±`·P®¦ ¤j«L´£¨Ñªº¤èªk»P¥Î¤ßªº¨ç¼Æ
³o­Ó¤w¸Ñ¨M°ÝÃD

¦A¦¸ªºÁÂÁÂ

TOP

        ÀR«ä¦Û¦b : ¦³Ä@©ñ¦b¤ß¸Ì¡A¨S¦³¨­Åé¤O¦æ¡A¥¿¦p¯Ñ¥Ð¤£¼½ºØ¡A¬Ò¬OªÅ¹L¦]½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD