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

[µo°Ý] ¦p¦ó¦X¨Ö°}¦C

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-5-18 09:18 ½s¿è

¦^´_ 7# sunnyso
¦^´_ 5# GBKEE
¦^´_ 8# Hsieh
ÁÂÁ GBKEE ¥H¤Î Hsieh ¨â¦ì¤j¤jªº½d¨Ò¡C
¯÷±N¥¦­Ìµyµy¤Þ¥Î¡G
  1. Option Explicit

  2. Sub EX()            '  GBKEE
  3.     Dim A As Variant, B As Variant, C As Variant, I As Integer
  4.     A = Array(Array("A1", "B1", "C1"), Array("A2", "B2", "C2") ,Array("A3", "B3", "C3"), Array("A4", "B4", "C4"))
  5.     B = Array(Array("A5", "B5", "C5"), Array("A6", "B6", "C6"))
  6.     C = A
  7.     For I = 0 To UBound(B)
  8.         ReDim Preserve C(0 To UBound(C) + 1)
  9.         'ReDim ³¯­z¦¡  ¦bµ{§Ç¼h¦¸¤¤¥Î¨Ó­«·s°t¸m°ÊºA°}¦CÅܼƪºÀx¦sªÅ¶¡¡C
  10.         'Preserve  ·í§ïÅܭ즳°}¦C³Ì«á¤@ºûªº¤j¤p®É¡A¤´µM«O¦³­ì¨Óªº¸ê®ÆªºÃöÁä¦r
  11.         C(UBound(C)) = B(I)
  12.     Next
  13.     Range("A1").CurrentRegion = ""
  14.     '  UBound(C) = 5,  UBound(C(0)) = 2
  15.     [A1].Resize(UBound(C) + 1, UBound(C(0)) + 1) = Application.Transpose(Application.Transpose(C))                       ' °}¦CA¼g¤J¤u§@ªí
  16. End Sub

  17. Sub EX2()             '  Hsieh
  18.     Dim A As Variant, B As Variant, C As Variant, D As Variant, I As Integer

  19.     Range("A1").CurrentRegion = ""
  20.     A = Array(Array("A1", "B1", "C1"), Array("A2", "B2", "C2"), Array("A3", "B3", "C3"), Array("A4", "B4", "C4"))
  21.     B = Array(Array("A5", "B5", "C5"), Array("A6", "B6", "C6"))

  22.     '  UBound(A) = 3, UBound(A(0)) = 2
  23.     [A1].Resize(UBound(A) + 1, UBound(A(0)) + 1) = Application.Transpose(Application.Transpose(A))                       ' °}¦CA¼g¤J¤u§@ªí
  24.     '  UBound(A) = 3, UBound(B) = 1, UBound(B(0)) = 2
  25.     [A1].Offset(UBound(A) + 1).Resize(UBound(B) + 1, UBound(B(0)) + 1) = Application.Transpose(Application.Transpose(B)) ' °}¦CB¼g¤J¤u§@ªí

  26.     D = Range("A1").CurrentRegion.Value                                                                   ' ±NÀx¦s®æ¸ê®Æ¦s¦¨·s°}¦C
  27.     Range("A1").CurrentRegion = ""
  28.     '  UBound(D, 1) = 6,  UBound(D, 2) = 3
  29.     [A1].Resize(UBound(D, 1), UBound(D, 2)) = D                                                           ' ¼g¦^¤u§@ªí
  30. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¦³¤ß´N¦³ºÖ¡A¦³Ä@´N¦³¤O¡A¦Û³yºÖ¥Ð¡A¦Û±oºÖ½t¡C
ªð¦^¦Cªí ¤W¤@¥DÃD