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

[µo°Ý] ¦p¦ó­pºâ¨C­ÓÄ檺²Ö­p³Ì¤j¥¢¤À

[µo°Ý] ¦p¦ó­pºâ¨C­ÓÄ檺²Ö­p³Ì¤j¥¢¤À

½Ð±Ð¤j¤j¥H¤U¦p¦ó§Q¥ÎVBA°µ¨ì¡AÁÂÁÂ!
7¦C=DÄ椤²Ö­p³Ì¤j¥¢¤À(¶À¦â³¡¥÷)
8¦C=DÄ椤²Ö­p²Ä2¤j¥¢¤À(ºñ¦â³¡¥÷)
9¦C=DÄ椤²Ö­p²Ä3¤j¥¢¤À(¾í¦â³¡¥÷)
test3.rar (3.53 KB)

¦^´_ 1# cdkee

­º¥ý¥Ñ¤W¦Ó¤U§â³Ð·s°ªªºÀx¦s®æ¬D¥X¨Ó°O¿ý¦n¼Æ­È¡A¦A§â¨â¨â³Ð·s°ªÀx¦s®æ¤¤¶¡½d³òªº³Ì¤p­ÈÀx¦s®æ¬D¥X¨Ó­pºâ³Ì¤j¥¢¤À¡A³Ì«á¦A±Æ§Ç¥X³Ì¤p­È¡B²Ä¤G¤p¡B²Ä¤T¤pªº¼Æ¦rÅã¥Ü¥X¨Ó§Y¥i
¯u¤ß·PÁ¨C¤@¦ìÄ@·N¤À¨É©Ò¾Ç¡B«ü¾É·s¤âªº¤H!

TOP

¦^´_ 2# VBALearner

©l²×§Ë¤£²M¡A¥i§_½Ð¦U¦ì¤j¤j¥Ü½d¡AÁÂÁÂ!

TOP

¥»©«³Ì«á¥Ñ VBALearner ©ó 2016-8-14 20:39 ½s¿è

¸Óµ{¦¡½X³]©w±zªº15­Ó¼Æ¾Ú¦bA1¨ìA15¡A¬ÝÀ´µ{¦¡½X«á¥i¦Û¦æ§ó§ïCells(?,?)
¤]§Æ±æ¦³°ª¤â¯à¨Ó°Ñ»P°Q½×²¤Æ©Î´£¥X§ó¼F®`ªº¤èªkOwO
  1. Option Base 1
  2. Sub test()
  3.     Dim NewHigh, NewLow, i, j, k As Integer: NewHigh = 0: NewLow = 0: j = 1: k = 1
  4.     Dim NewLowRecord(15), FinalRecord()
  5.    
  6.     For i = 2 To 15
  7.         If Cells(i, 1).Value >= NewHigh Then '¬ö¿ý³Ð·s°ªÃa«ù¥­
  8.             NewHigh = Cells(i, 1).Value
  9.             If Not IsEmpty(NewLowRecord(1)) Then '§PÂ_«D³sÄò³Ð°ª
  10.                 ReDim Preserve FinalRecord(j)
  11.                 FinalRecord(j) = Application.Small(NewLowRecord, 1) '¬ö¿ý³Ð°ª°Ï¶¡¤º©Ò¦³©Ô¦^ªº³Ì¤p­È
  12.                 Erase NewLowRecord '²MªÅ©Ô¦^­È¼È¦s
  13.                 j = j + 1
  14.                 k = 1
  15.             End If
  16.         Else
  17.             NewLow = Cells(i, 1).Value - NewHigh
  18.             NewLowRecord(k) = NewLow '¬ö¿ý©Ô¦^­È(»P¤W¤@·s°ª¤§®t)
  19.             k = k + 1
  20.         End If
  21.     Next
  22.    
  23.     MsgBox "³Ì¤j©Ô¦^ : " & Application.Small(FinalRecord, 1)
  24.     MsgBox "²Ä¤G¤j©Ô¦^ : " & Application.Small(FinalRecord, 2)
  25.     MsgBox "²Ä¤T¤j©Ô¦^ : " & Application.Small(FinalRecord, 3)
  26. End Sub
½Æ»s¥N½X
³Ì¤j¥¢¤À(©Ô¦^).zip (11.63 KB)
¦^´_ 3# cdkee
¯u¤ß·PÁ¨C¤@¦ìÄ@·N¤À¨É©Ò¾Ç¡B«ü¾É·s¤âªº¤H!

TOP

¦^´_ 4# VBALearner
´«´ö¤£´«ÃÄ,¨Ó´ê¤@¸}
  1. 'Option Base 1  '©Ò­×§ïªºµ{¦¡¥i¤£¥² Option Base 1
  2. Sub Ex()
  3.     Dim NewHigh As Long, NewLow As Long, LowRecord As Long, i As Integer, j As Integer
  4.     Dim FinalRecord()
  5.     ' NewHigh = 0: NewLow = 0 ' **Åܼƫ¬ºA¬°¼Æ¦r,µ{¦¡¤@¶}©l¬Ò¬°0­È
  6.     For i = 2 To 15
  7.         If Cells(i, 1).Value >= NewHigh Then '¬ö¿ý³Ð·s°ªÃa«ù¥­
  8.             NewHigh = Cells(i, 1).Value
  9.             If LowRecord <> 0 Then  '§PÂ_«D³sÄò³Ð°ª
  10.                 ReDim Preserve FinalRecord(0 To j)
  11.                 FinalRecord(j) = LowRecord
  12.                 LowRecord = 0             '²MªÅ©Ô¦^­È¼È¦s
  13.                j = j + 1
  14.             End If
  15.         Else
  16.             NewLow = Cells(i, 1).Value - NewHigh
  17.             LowRecord = IIf(LowRecord >= NewLow, NewLow, LowRecord)
  18.         End If
  19.     Next
  20.     MsgBox "³Ì¤j©Ô¦^ : " & Application.Small(FinalRecord, 1)
  21.     MsgBox "²Ä¤G¤j©Ô¦^ : " & Application.Small(FinalRecord, 2)
  22.     MsgBox "²Ä¤T¤j©Ô¦^ : " & Application.Small(FinalRecord, 3)
  23. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# VBALearner
¦^´_ 5# GBKEE
ÁÂÁ¨â¦ì¤j¤j«ü¾É!
¦]¬°·|¤£Â_¦³¦h²Õ²Ö­p¤À¼Æ¥[¤J¡A¦A½Ð±Ð¦p¦ó±Nµ²ªG©ñ¦b7,8,9¦C¡AÁÂÁÂ!
test5.rar (9.15 KB)

TOP

¦^´_ 6# cdkee

©ñ¦b7,8,9¦C
  1.     Cells(7,??) = Application.Small(FinalRecord, 1)
  2.     Cells(8,??) = Application.Small(FinalRecord, 2)
  3.     Cells(9,??) = Application.Small(FinalRecord, 3)
½Æ»s¥N½X
¤£Â_©¹¤U²Î­p·s¼Wªº¸ê®Æ
  1. Do while Cells(i,??).value <> ""
  2. ...
  3. i=i+1
  4. loop
½Æ»s¥N½X
¯u¤ß·PÁ¨C¤@¦ìÄ@·N¤À¨É©Ò¾Ç¡B«ü¾É·s¤âªº¤H!

TOP

¦^´_ 7# VBALearner

ÁÂÁ¤j¤j¦A¦¸±Ð¾É!
¨Ò¤l¬O¦V¥k¼W¥["²Ö­p¤À¼Æ"²Õ¡A¨C²Õ³£¦b7,8,9¦CÅã¥Üµ²ªG¡AÀ³¦p¦ó§ï¼g¡AÁÂÁÂ!

TOP

¥»©«³Ì«á¥Ñ VBALearner ©ó 2016-8-15 15:02 ½s¿è

¦^´_ 8# cdkee

i¬O¸ê®Æ³Ì¥ªÃ䪺°_©lÄæ¦ì½s¸¹¡ADÄæ´N¬O4
¸ê®Æ¦ì¸m¸ò...ªº³¡¤À´N¨Ì·Ó§Aªº»Ý­n¦Û¦æ§ï¼g§a~
  1. i = 4
  2. do while cells(20,i) <> ""
  3.    
  4.     ...'­pºâ¥¢¤Àµ{¦¡

  5.     cells(7,i) = application.worksheetfunction.Small(FinalRecord,1)
  6.     cells(8,i) = application.worksheetfunction.Small(FinalRecord,2)
  7.     cells(9,i) = application.worksheetfunction.Small(FinalRecord,3)
  8.     i = i + 1
  9. loop  
½Æ»s¥N½X
¯u¤ß·PÁ¨C¤@¦ìÄ@·N¤À¨É©Ò¾Ç¡B«ü¾É·s¤âªº¤H!

TOP

¥u¦³²Ä1²Õ­pºâ¥¿½T¡A¨ä¥L²Õ³£­pºâ¤£¥¿½T¡A½Ð¤j¤jÀ°¦£À³¸Ó¦p¦ó§ï¡AÁÂÁÂ!
test5V.rar (14.69 KB)

TOP

        ÀR«ä¦Û¦b : §ïÅܦۤv¬O¦Û±Ï¡A¼vÅT§O¤H¬O±Ï¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD