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

[µo°Ý] ½Ð°ÝÃö©ó°ÊºA°}¦CReDim

[µo°Ý] ½Ð°ÝÃö©ó°ÊºA°}¦CReDim

ª¾¹D«Å§i°}¦C Dim Arr(10) As Integer ¸Ì­±¦³11­ÓªÅ¶¡
¨º°²³]§Ú¤£ª¾¹D§Ú¤µ¤Ñ¸ê®Æ·|²£¥X¦h¤Öµ§. Ex 20..30..40..100..500...

¬O¤£¬O­n§ï¨Ï¥ÎReDim¨Ó«Å§i©O?

¦ý§Ú¬Ý¤FReDimªº»¡©ú¦³¬Ý¨S¦³À´,¤W¨Ó½×¾Â½Ð±Ð¦U¦ì«e½ú...

¥Î³Ì²³æªº»¡©ú¡ã~

«Å§iªÅ°}¦C Dim Arr()
Redim preserve Arr(·s°}¦C¤j¤p)

TOP

¼Ó¤W¤j¤j±z¦n¡A¥i¥H¥Ü½d¤@¤U¶Ü...?

¨Ò¦pReDim­n´¡©ñ¦b­þ¸Ì¡A©Î¬OÀHµÛ¸ê®Æªº¼W¥[©Î´î¤Ö¥h±±¨îReDim...³Â·Ð¤j¤j¤F

TOP

¦^´_ 3# EGBT

§Ú¥Î¤@­Ó²³æªº¨Ò¤l»¡©ú¡G
¥H¤U¦Cµ{¦¡½X¨Ó»¡¡Aµ{¦¡Åª¨ú±qA1¨ìAÄ檺³Ì«á¤@®æ°µ¬°µ{¦¡³B²zªº½d³ò¡A¦ý§Ú¤£ª¾¥¦³Ì«á·|¸¨¦b­þ¸Ì¡A
³o®É´N¥i¥H§Q¥ÎReDim¤F¡AÅý¥¦¤@­Ó¤@­Ó²Ö¥[¨ì³Ì®æ³B²zªºÀx¦s®æ¡A¦ý³o¸Ì­nª`·Nªº¨Æ¬OReDim¥u¯à¼W¥[³Ì«á¤@ºûªººû«×
¨Ò¦pReDim arr(1 to 3,1 to n)¥u¯à¼W¥[¬õ¦r³¡¥÷ªººû«×
­YReDim«á­±¨S¦³¥[¤WPreserve«h¨C¦¸¼W¥[ºû«×«á¥²·|§R°£­ì¨Ó°}¦Cªº¤º®e¡A©Ò¥H¥H¤U¦Cµ{¦¡¨Ó»¡¬°¤F¤£§R°£¨ä°}¦C¤¤ªº¤º®e
¬G¼g¬° ReDim Preserve ar(n)
  1. Sub Ex()
  2. Dim ar()
  3. n = 1
  4. For Each Rng In Range("a1", Cells(Rows.Count, 1).End(xlUp).Address)
  5.     ReDim Preserve ar(n)
  6.     ar(n) = Rng
  7.     n = n + 1
  8. Next
  9. [C1].Resize(UBound(ar)) = Application.Transpose(ar)
  10. End Sub
½Æ»s¥N½X

TOP

«¢¡A«ÜÁÂÁ¼ӤW¤j¤jªº­@¤ß¦^µª~~~

TOP

¦^´_ 4# lpk187


¤j¤j,¨º§Ú½Ð°Ý¤@¤U~

¬O¤£¬O­n¥ý¦³Dim ar()

«á­±¤~¯à¨Ï¥ÎReDim...

ReDim°ÊºA°}¦C¤£¬O©ñ¦b«e­±¨Ï¥Î¶Ü

«¢...¤p§Ì²Â©å..

¹³¬O¥ý«Å§i°}¦C¦b«Å§i¥Lªº°ÊºA°}¦C

Sup Ex()

Dim ar()
ReDim Preserve ar(n)
...
..
..
..



End Sup

³Â·Ð¤j¤j¦Aµ¹¤p§Ì¦hÂI´¼¼z°Ú~~~

TOP

¥»©«³Ì«á¥Ñ lpk187 ©ó 2015-8-15 14:09 ½s¿è

¦^´_ 6# EGBT


    ReDim¥²»Ý¥ý¦æ«Å§iDim ar()
§A¼gªº¨Ò¤l¬O³o¼Ë¨S¿ù¡I

TOP

¦n®@ ¤F¸Ñ~©Ò¥H§Ú¥i¥H¥´¦¨

Dim ar()
ReDim ar(n+1)

³o¼Ë¥i¥H¶Ü¡H

TOP

¦^´_ 8# EGBT


    ¤£¦æ¡I³o¼ËN¨Sªk²Ö¥[¡A¤@©w­n¥t¥~¼g
n=n+1

TOP

¦^´_ 6# EGBT
§Æ±æ¦¹¹Ï¸Ñ¯à¹ï§A¦³©ÒÀ°§U¡G

TOP

        ÀR«ä¦Û¦b : ¤Ó¶§¥ú¤j¡B¤÷¥À®¦¤j¡B§g¤l¶q¤j¡A¤p¤H®ð¤j¡C
ªð¦^¦Cªí ¤W¤@¥DÃD