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

[µo°Ý] §¹¦¨for-next¦^°é«áªºÅܼƭÈ...¬O¤°»ò?

[µo°Ý] §¹¦¨for-next¦^°é«áªºÅܼƭÈ...¬O¤°»ò?

¥»©«³Ì«á¥Ñ oak0723-1 ©ó 2010-9-10 16:25 ½s¿è

¥H¤Uµ{¦¡½X
¬°¦ó°õ¦æµ²ªG[j]=61
    r = 1
    For i = 1 To 10
        r = r + 6
    Next
    [j9] = r
¤£À´³o­Óµ{¦¡½XªºÅܼÆÅܤÆ
¬O§_¯à¦³­þ¦ì¥ý¶i«ü±Ð

990909-1.rar (10.4 KB)

ªþ¥ó¤u§@ªí¤¤ªÅµL¤@ª«¡Aªí¦W¤]¤£¹ï¡A¥N½X¸ò¥»¤£¯à°õ¦æ¡C
¤G­Ó¤£¦P¥Øªºªº¥N½X¹B¦æªºµ²ªG·íµM¤£¦P¡I

TOP

¥H¤Uµ{¦¡½X
¬°¦ó°õ¦æµ²ªG[j]=61
    r = 1
    For i = 1 To 10
        r = r + 6
    Next
    [j9] = r
rªº°_©l­È¬°1¡A¶i¦æ¤F10¦¸´`Àô¡A¨C¦¸´`Àôrªº­È¥[6¡A³Ì«á·íµMr¬°61¤F
¤£À´§Aªº°ÝÃD¬O¤°»ò¡C

TOP

³o¬O¥Îf8Áä³v¨B´`Àô¬d¬ÝÅܼƪº¤èªk¡C dd.gif

TOP

¥»©«³Ì«á¥Ñ oak0723-1 ©ó 2010-9-10 19:48 ½s¿è

¦^´_ 4# oobird


    ¨ä¹ê¤p§Ì´N¬O¦b±´°Q¤§«eoobird¤j¤j§AÀ°¤p§Ì¼gªº¨º2­Óµ{¦¡½X
µ{¦¡½X1>
Private Sub CommandButton1_Click()
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
³o®Éªºk­È¬O¤°»ò
©Ò¥H¤p§Ì¥Î
¥H¤Uµ{¦¡½X¥h¸Õ
µ{¦¡½X2>
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
[q9] = k
µ²ªG¦pªþ¥ó«öÁätest3°õ¦æµ²ªG
¦bªþ¥ó¤¤°õ¦æµ²ªG¬O18
¨º¬O¤£¬O¦bµ{¦¡½X1¤¤ªº³Ì«á¨º2¦æµ{¦¡½X¤¤ªºk­È´N¬O18?
­Y¬O~~~¤p§Ì´N§ó¤£À´¤F~~~~
Sheets("2").UsedRange = ""
Sheets("2").[a5].Resize(k, 10) = arr
©Î³\¤p§Ì¹ïResizeªº·N¸q¦³©Ò»~¸Ñ~~~~
©Î®Ú¥»¤£À´Sheets("2").[a5].Resize(k, 10) = arr³o¥yµ{¦¡½Xªº·N«ä~~~
ÁٷниѴb~~~

990910-2.rar (35.02 KB)

TOP

¦^´_ 5# oak0723-1


k´N¬O²Å¦X±ø¥ó rng(i, 11) - rng(i, 10) <> 0 ªº¼Æ¶q
µ{¦¡¤¤arr°}¦C¦bRedim®É¤w¸g½T©w¤j¤p(´N¬OUbound(rng))
¥i¨£k¤@©w¬O¤p©óUbound(arr,1)
©Ò¥Hªí¥Ü§A¬O±Narr°}¦C«e­±k¦C¼g¤J¤u§@ªí¦Ó¤w
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ oak0723-1 ©ó 2010-9-10 20:42 ½s¿è

¦^´_ 6# Hsieh


    hsieh¤j¤j§A¦n
²{¦b¤p§Ì¤j·§À´kªº·N«ä
©Ò¥H§Ú·Q§Ú¬O¤£À´Resizeªº·N¸q~~~~
ÁÙ¦³¬Ý¤£À´Sheets("2").[a5].Resize(k, 10) = arr³o¥yµ{¦¡½Xªº·N«ä~~~
¥i¥HÀ°¤p§Ì¸ÑÄÀ¶Ü?

TOP

¦]¬° arr¬O¤@­Ók*10ªº¤Gºû°}¦C¡Aµo¼g¤Ja5¶}©lªºk¦C*10Ä檺¦ì¸m¡A
­n§âa5¤@­ÓÀx¦s®æ¦V¥~©Ý®i¬°k¦C*10Äæ´N­nresize.
¦pk­È¬°100
[a5].Resize(k, 10)´NÅܦ¨a5:j104ªº½d³ò¡C

TOP

¦^´_ 7# oak0723-1


    ¤£À´Resize´N§â´å¼ÐÂI¨ìResizeµM«á«öF1¬Ý»¡©ú
«Øij§A¥ý§â¥H¤U2½gŪ¹L¦A¶i¤@¨B
http://forum.twbts.com/viewthread.php?tid=26&extra=page%3D19
http://forum.twbts.com/viewthread.php?tid=25&extra=page%3D19
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 8# oobird


    [a5].Resize(k, 10)´NÅܦ¨a5:j104ªº½d³ò¡C
¬Oµ§»~¶Ü?
¤j¤j§Aªº·N«ä¬OÀ³¸Ó³o¼Ë¶Ü
[a5].Resize(k, 10)´NÅܦ¨a5:j10ªº½d³ò
Hsieh
·PÁ§Aµ¹ªº¸ê®Æ
¨º2½g¤å¤p§Ì¦³¬Ý¹L
¥i¯à¬O¤p§Ìµ¹¥L¦³¬Ý¨S¦³À´
§Ú·|¦Aµ¹¥L¬Ý¹L

TOP

        ÀR«ä¦Û¦b : °ß¨ä´L­«¦Û¤vªº¤H¡A¤~§ó«i©óÁY¤p¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD