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

¦p¦ó§â¨â­ÓArray¦X¨Ö?

¦p¦ó§â¨â­ÓArray¦X¨Ö?

°£¤F³o­Ó³Â·Ð¿ìªk¥~
  1. Sub abc()
  2. Dim a(), b(), c(), i
  3. a = Array("Tony", "Garnett")
  4. b = Array("Allen", "Pierce", "Bryant")
  5. ReDim Preserve c(UBound(a) + UBound(b) + 1)
  6. For i = 0 To UBound(a)
  7. c(i) = a(i)
  8. Next
  9. For i = 0 To UBound(b)
  10. c(i + UBound(a) + 1) = b(i)
  11. Next
  12. End Sub
½Æ»s¥N½X
¦³¨S¦³§Ö±¶¤èªk³B²z?
80 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

¦^´_ 1# FAlonso
¾A¥Î¤@ºû°}¦C
  1. Sub ex()
  2. Dim a(), b(), C As Variant
  3. a = Array("Tony", "Garnett")
  4. b = Array("Allen", "Pierce", "Bryant")
  5. C = Join(a, ",") & "," & Join(b, ",")
  6. C = Split(C, ",")
  7. MsgBox Join(C, ",")
  8. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# GBKEE
  1. Sub combine_array_GBKEE()
  2. Dim a(), b(), c As Variant, d(), i As Integer, j As Integer
  3. a = Array("Tony", "Garnett")
  4. b = Array("Allen", "Pierce", "Bryant")
  5. c = Join(a, ",") & "," & Join(b, ",")

  6. i = UBound(Split(c, ","))
  7. ReDim Preserve d(i)
  8. For j = 0 To i
  9. d(j) = Split(c, ",")(j)
  10. Next

  11. End Sub
½Æ»s¥N½X
¤w¸g²¤§@­×§ï,§¹¦¨¤F
¦hÁ¦U¦ì«ü¾É
80 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¦^´_ 4# chin15
§Aªºµo¤å¤U¤è    [½s¿è],
¤Ä¿ï¥k¤W [§R] ,[½s¿è©«¤l]  
§R°£§¹²¦

TOP

ÁÂÁ«ü±Ð¡A§Ú·|¤F
¤w¦¨¥\§R°£¦Û¤v³y¦¨ªº©U§£

TOP

¦^´_ 3# FAlonso
  1. Sub Ex()
  2.     Dim A(0 To 3), C(), E, R
  3.     A(0) = Array("Tony", "Garnett")
  4.     A(1) = Array("Allen", "Pierce", "Bryant")
  5.     A(2) = Array("A1", "B1", "C1")
  6.     A(3) = Array("AA1", "BB1", "CC1")
  7.     ReDim C(0)
  8.     For Each E In A
  9.         For Each R In E
  10.             C(UBound(C)) = R
  11.             ReDim Preserve C(UBound(C) + 1)
  12.         Next
  13.     Next
  14.     ReDim Preserve C(UBound(C) - 1)
  15.     MsgBox Join(C, ",")
  16. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤H¤£©È¿ù¡A´N©È¤£§ï¹L¡A§ï¹L¨Ã¤£Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD