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

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

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

¥»©«³Ì«á¥Ñ oak0723-1 ©ó 2010-9-6 21:17 ½s¿è

¦pªþ¥ó
¦b¤u§@ªí1¤§[c10:m83]¿é¤J¸ê®Æ
·Q±o¨ì¦p¤u§@ªí2-1¤§µ²ªG
¤]´N¬O»¡·í¤u§@ªí2-1ªºjÄ椺®e¸g­pºâ¬°0®É´N¤£±N¸Ó¦CÅã¥Ü©ó¤u§@ªí2-1
µù
¬°¤è«K»¡©ú
ªþ¥ó¤¤¤u§@ªí2¤£½×jÄ椺®e¬O§_¬°0±N¥þ³¡Åã¥Ü¥X¨Ó¤§±¡§Î
¦Óªþ¥ó¤¤¤u§@ªí2-1¬O±NjÄ椺®e¬°0¤£Åã¥Ü¤§±¡§Î

¥»©«³Ì«á¥Ñ 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

¦^´_ 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

©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

¦^´_ 9# oobird


    §¹¤F~~~
§Ú¤S¬Ý¤£À´¤F
§Ú¶Rªº®Ñ¤W´£¨ì
©T©w°}¦C¬O¥Hdim«Å§i
ÅÜ°Ê°}¦C¬O¥HRerdim«Å§i
¦¹³B¤Îhttp://forum.twbts.com/viewthread.php?tid=1282
³o2­Ó°ÝÃD¤£¬O³£¥Îredim«Å§i¶Ü?

TOP

³o­Ó¤£¬O°ÊºA°}¦C¡AÅܼƥi³]¦b¥ô¦ó¤@ºû¡C
¦]¬°§A¤£²ßºDtranspose,©Ò¥H©ñ±ó°ÊºA°}¦C¡A³o¼Ë§A¥i¯à¸û®e©ö§l¦¬¡I

TOP

¦^´_ 7# oobird


    ½Ð°Ý
¤§«e´£¨ì
°ÊºA°}¦C¦³­Ó³W«h¡A´N¬O¥u¯à§ïÅܲĤGºûªº¤j¤p
http://forum.twbts.com/viewthread.php?tid=1282
³o¸Ì«oarr(1 To UBound(rng), 1 To 10)
ÅܼƳ]¦b²Ä¤@ºû
¤]´N¬O¦C¦ì¬°ÅܼÆ
³o~~~¨ì©³¬O¦ì¤°»ò?

TOP

If rng(i, 11) - rng(i, 10) <> 0 Then
³o¤@¦æµø§A­n¥[©Î´î

TOP

Sub yy()
Dim rng, arr, i%, j%, k%
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
arr(k, 8) = rng(i, 8) - rng(i, 6)
arr(k, 9) = arr(k, 8) - arr(k, 6)
arr(k, 10) = rng(i, 11) + rng(i, 10)
End If
Next
Sheets("2").UsedRange = ""
Sheets("2").[a5].Resize(k, 10) = arr
End Sub

TOP

¥»©«³Ì«á¥Ñ oak0723-1 ©ó 2010-9-6 22:29 ½s¿è

¦^´_ 6# oobird


    ³á
©êºp¥i¯à¤p§Ì¼g¨S²M·¡
·N«ä´N¬O»¡
­Y¤u§@ªí1¸ÌªºM10+L10=0
¦b¤u§@ªí2´N¤£Åã¥Ü¸Ó¦C(²Ä10¦C)
¤w­×¥¿¦pªþ¥ó~~~

990906-1.rar (29.81 KB)

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¤£¤@©w²y²y¬O¦n²y¡A¦ý¬O¦³¾ú½mªº±j¥´ªÌ¡AÀH®É³£¥i¥H´§´Î¡C
ªð¦^¦Cªí ¤W¤@¥DÃD