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

Ãö©ó°ÊºA°}¦Cµ{¦¡½Xªº°ÝÃD

Ãö©ó°ÊºA°}¦Cµ{¦¡½Xªº°ÝÃD

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
°ÝÃD >³o¸Ìªºkªº°_©l­È¨Ã¨S¼g...³o¼Ë¨S¦³¼gªºª¬ªp¬O¤£¬O¥Nªík¬O±q0¶}©l
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
°ÝÃD >³o¸Ìªºk¤£¬O¤w¸g¸õ¥Xfor-next°j°é..¥B¸Ó¦^°é¤]¨S¦³Preserve...¨º¤£¬Ok­È´N¨S°O¾Ð?k¤£´N¬OªÅªº¶Ü?
End Sub

¦^´_ 1# oak0723-1
Q1:   K¥¼³]©w®É¬° 0
k = k + 1 -> K=0+1 ->K=1
Q2:   ¦¹®É µ{§Ç¨S¦³µ²§ô  ¥BKªº­È¨Ã¨S¦³ ³]©w¬° Empty  kÁÙ¬O¦³¼Æ­Èªº

TOP

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

¤°»ò¬OEmpty
¯uªº¤£¤ÓÀ´
¤p§Ì¥t¥~
¨ú1­Ó¨Ò¤l¦pªþ¥ó
¤À§O¥H¦³Preserve©MµLPreserve¤§ª¬ªp¸Õ¸Õ
°õ¦æªºµ²ªG........«oÅý¤p§Ì§ó¤£©ú¥Õ~~~

990908-2.rar (17.33 KB)

TOP

¦^´_ 3# oak0723-1
  1. Private Sub CommandButton2_Click()
  2. Dim a, r%, i%, arr()
  3.     a = Sheets("1").[c10].CurrentRegion
  4.     r = 1
  5.     For i = 1 To UBound(a)
  6.         ReDim Preserve arr(1 To 3, 1 To r)
  7.         arr(1, r) = a(i, 1): arr(2, r) = a(i, 2): arr(3, r) = a(i, 3)
  8.         r = r + 6
  9.     Next
  10.     [j9] = r
  11.        For j = 1 To UBound(arr, 2)
  12.    For i = 1 To 3
  13.       mystr = mystr & "," & arr(i, j)
  14.       Next: Next
  15.       MsgBox mystr


  16. End Sub

  17. Private Sub CommandButton3_Click()
  18. Dim a, r%, i%, arr()
  19.     a = Sheets("1").[c10].CurrentRegion
  20.     r = 1
  21.     For i = 1 To UBound(a)
  22.         ReDim arr(1 To 3, 1 To r)
  23.         arr(1, r) = a(i, 1): arr(2, r) = a(i, 2): arr(3, r) = a(i, 3)
  24.         r = r + 6
  25.     Next
  26.    [j12] = r
  27.    For j = 1 To UBound(arr, 2)
  28.    For i = 1 To 3
  29.       mystr = mystr & "," & arr(i, j)
  30.       Next: Next
  31.       MsgBox mystr
  32. End Sub
½Æ»s¥N½X
¤À§O°õ¦æ¦¹2µ{§Ç´Nª¾ ¹DPreserveªº®ÄªG
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# Hsieh


    ½Ð°Ý[j9]©M[j12]©ÒÅã¥Ü¼Æ­Èªº·N¸q¬O?

TOP

¦^´_ 5# oak0723-1

arr¬O­Ó¤Gºû°}¦C
ReDim arr(1 To 3, 1 To r)¸ò
ReDim Preserve arr(1 To 3, 1 To r)
³£¬O¦b§ïÅÜarr°}¦Cªº²Ä2ºû¼Æ¶q
¥u¤£¹L·í¨C¦¸redim«á­Y¨S¦³¨Ï¥ÎpreserveÃöÁä¦r
«h·|²M°£©Ò¦³°}¦C¤¸¯À¤º®e
¦ý¼Æ¶qÁÙ¬O¦³¼W¥[
©Ò¥H§A´ú¸Õ2­Óµ{§Ç«á¦³¨Ï¥ÎpreserveÃöÁä¦rªºµ{§Ç
msgbox¤º®e·|¦³§A­nªº¤å¦r
¥u¦³redimªºµ{§Ç³£¥u¦³³r¸¹(ªí¥Üarrªº¤º®e³£¬OªÅ­È)
©Ò¥H[j9][j12]·|±o¨ì¬Û¦Pªº­È
¤]´N¬Oarr°}¦Cªº²Ä¤Gºû¤j¤p
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ oak0723-1 ©ó 2010-9-9 15:52 ½s¿è

¦^´_ 6# Hsieh


¤p§ÌÁÙ¦³­ÓºÃ°Ý
¦b²Ä1­Ó´ú¸Õªº§t¦³Preserveµ{¦¡½X¤¤°õ¦æ«á
¬°¦ó¦b¼Æ­È»P¼Æ­È¶¡ÁÙ·|¥X²{³\¦h³r¸¹?(ªí¥Ü¸ê®Æ¬OªÅªº?)
¨Ò¦p:,a-1,b-1,c-1,,,,,,,,,,,,,,,,a-2,b-2,c-2,,,,,,,
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
¦b¥H¤W³o¬qµ{¦¡½X¤¤...¤£¬O§â°}¦Cªº¨C­Ó¸ê®Æ¦ì¤l³£«ü©w¶ñº¡¤F¶Ü?
¬°¦ó¸ê®Æ»P¸ê®Æ¶¡ÁÙ¦³¨º¦h­Ó³rÂI(¤p§Ìºâ¤F1¤U..¦³16­Ó)

TOP

¦^´_ 7# oak0723-1


    §Ar¨C¦¸¥[6§A»¡·|¶]¹M¨C­Ó°}¦C¤¸¯À¶Ü?
§A­n¥h«ä¦ÒÅܼƪºÅܤƭÈ
³r¸¹¬O¦]¬°§Úµ{¦¡¤¤mystr¬O±N°}¦C¤¸¯À¥Î³r¸¹³s±µ
·í¤¸¯À¬OªÅ­È®É¦ÛµM¥u²£¥Í³r¸¹¨S¦³­È
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

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

¦^´_ 8# Hsieh


  ¬°¦ó¦³ªÅªº°}¦CÀx¦s¦ì¸m¬O¦]¬°Åã¥Ü¬O±N¨C­Ó°}¦CÀx¦s¦ì¸m³£Åã¥Ü
¦]¬°r¨C¦¸³£¥[6
©Ò³y¦¨³¡¤ÀÀx¦s¦ì¸mÅã¥Ü¬OªÅªº
¬O³o­Ó·N«ä¶Ü?
¨º¼Æ­È¸ò¼Æ­È¶¡À³¸Ó¦³5*3=15­Ó°}¦CÀx¦s¦ì¸m¬OªÅªºÅo?
©Ò¥H¤~Åã¥Ü16­Ó³r¸¹
¦]¬°¨C2­Ó³r¸¹¶¡¦³1­ÓªÅªº¼Æ­È¦s¦b?
¼K¼K
À´¤F
·P®¦~~~~

TOP

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

¦^´_ 8# Hsieh


    ¨º¦b½Ð±Ð¤j¤j
¥Ñ³o­Óµ{¦¡½X
Dim a, r%, i%, arr()
    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
    [j9] = r
±o¨ìr445
¨º½Ð±Ð
¤U¦C³o­Óµ{¦¡½Xfor-next«áªºr(¬õ¦r¼Ð¥Ü)¤]¬O445¶Ü
    Dim a, r%, i%, arr()
    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
    Sheets("2").[c4].Resize(r - 6, 2) = Application.Transpose(arr)
    Sheets("2").[k4].Resize(r - 6, 1) = Application.Transpose(Application.Index(arr, 3))
¥H¤W¸Ôªþ¥ó

990909-2.rar (17.2 KB)

TOP

        ÀR«ä¦Û¦b : ¦Y­W¤F­W¡B­WºÉ¤Ü¨Ó¡A¨ÉºÖ¤FºÖ¡BºÖºÉ´d¨Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD