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

[µo°Ý] ­YÀx¦s®æ¤º®e¬°0´N¾ã¦C¤£Åã¥Ü

©T©w°}¦C¬O¥Hdim«Å§i
¨º¬O¦b¨Æ¥ýª¾¹D¤j¤pªº±¡ªp¡C
¦ý¬O§Ú­Ì¬O¦b°õ¦æ¨ìrng = .Range(.[c10], .[m83].End(3))
®É¤~ª¾¹D¶·­nªº¤j¤p(ÁöµM¤£¬O·Ç½T)
³o®É´N­n­«·s©w¸q¥Lªº¤j¤p¡A©Ò¥H¥Îredim!

TOP

¦^´_ 11# oobird


°}¦C1>
a = Sheets("1").[c10].CurrentRegion
    r = 1
    For i = 1 To UBound(a)
        ReDim Preserve arr(1 To 3, 1 To r)
        arr(1, r) = a(i, 1): arr(2, r) = a(i, 2): arr(3, r) = a(i, 3)
        r = r + 6
    Next
°}¦C2>
With Sheets("1")
rng = .Range(.[c10], .[m83].End(3))
End With
ReDim arr(1 To UBound(rng), 1 To 10)
For i = 1 To UBound(rng)
If rng(i, 11) - rng(i, 10) <> 0 Then
k = k + 1
For j = 1 To 6
arr(k, j) = rng(i, j)
Next
¤p§Ì¤ñ¸û¤F³o2­Ó°}¦C
µo²{¦b°}¦C2ªºrngÅܼƪº©w¸q
rng = .Range(.[c10], .[m83].End(3))
µ¥©ó³]©w¤Frngªº°_©l»P²×¤î½d³ò
¦Ó¦b°}¦C1ªºrÅܼÆ
¬O¨ü¨î©óÅܼÆa¦Ó²×¤î
ÅܼÆaªº©w¸q¬°
a = Sheets("1").[c10].CurrentRegion
³oµ¥©ó¨S¦³³]©wÅܼÆaªº²×¤î½d³ò
©Ò¥H¤j¤j§A¤~±N°}¦C1ºÙ¤§¬°ÅÜ°Ê°}¦C
°}¦C2ºÙ¤§¬°©T©w°}¦C
¦Ó«D³æ¯Â¥Hdim©Îredim§@§P§O°ò·Ç°Ï¤À©T©w©ÎÅÜ°Ê°}¦C?
¤p§Ì³o¼Ë²z¸Ñ¥¿½T¶Ü?

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2010-9-7 22:32 ½s¿è

¦^´_ 10# oak0723-1

¨ä¹ê¦b¤W­±ªºµ{¦¡¤¤¤§©Ò¥H¥i¥H¥Î ReDim ¨Ó­«·s°t¸m Arr ¬°¤@°}¦C¬O¦]¬° Arr ªì©l«Å§i®É¬O Variant «¬ºA,
©Ò¥H¥¦¤]¥i¥Hªí¥Ü¬°¬O¤@­Ó(©|¥¼©w¸q¤j¤pªº)°}¦C.

§A¥i¥H¶}±ÒExcel VBA ªº»¡©ú¨Ó¬Ý,
¥¦¹ï©ó ReDim ªº ¸ÑÄÀ¦p¤U :
ReDim ³¯­z¦¡¬O¥Î¨Ó "¨M©w" ©Î "­«·s¨M©w" °ÊºA°}¦Cªº¤j¤p


¦^´_ 12# oak0723-1

§Úı±o¤£ºÞ¬O .CurrentRegion ÁÙ¬O .End(3) ¨âªÌ¦bµ{¦¡°õ¦æ¨ì¸Ó¦æ®É³£·|¬O­Ó½T©wªº½d³ò,

¤§©Ò¥H ReDim Preserve arr(1 To 3, 1 To r) ·|»¡¥¦¬O­Ó°ÊºA°}¦C,
¬O¦]¬°¥¦¦b¤§«e¤w¸g¦³³Q©w¸q¹L°}¦C¤j¤p¤F, (¦]¦b°j°é¤¤·|­«½Æ°õ¦æ¸Ó±Ô­z¼Æ¦¸)
¤§«áÁٻݭn¦] r ­È¦ÓÅܰʨä¤j¤p¬G¦Ó¬O°ÊºA°}¦C.

¦Ü©ó

ReDim arr(1 To UBound(rng), 1 To 10)

«h¦]¸Ó±Ô­z¤§«e¥u¦³ Dim arr ¤@­Ó±Ô­z, (¤]¥iµø¬° Variant ÅܼÆ)
¨ä¹ê¨Ã¨S¦³¯uªº©ú½T©w¸q¹L arr ³o­Ó°}¦Cªº¤j¤p,
ª½¨ì¸Ó±Ô­z¤~¬O¯uªº±N¨ä©w¸q¬°¤@­Ó "©T©w¤j¤p" ªº°}¦C.

TOP

        ÀR«ä¦Û¦b : ¡i¬O§_µo´§¤F¨}¯à¡H¡j¤H¶¡¹Ø©R¦]¬°µu¼È¡A¤~§óÅã±o¬Ã¶Q¡CÃø±o¨Ó¤@½ë¤H¶¡¡AÀ³°Ý¬O§_¬°¤H¶¡µo´§¤F¦Û¤vªº¨}¯à¡A¦Ó¤£­n¤@¨ý¨Dªø¹Ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD