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

[µo°Ý] ¼Æ¦C¦±½uªº¨¦©³¼Æ­È¤Î¼Æ¦Cªº¦ì¸m VBA

[µo°Ý] ¼Æ¦C¦±½uªº¨¦©³¼Æ­È¤Î¼Æ¦Cªº¦ì¸m VBA

½Ð°Ý¡G   ¥ÎVBA ¨D¨ú¼Æ¦Cªº¨C¤@­Ó¨¦©³¼Æ­È¤Î¨ä¦ì¸m
   
   
   
    '¥H¤U¼Æ¦Cªº¨Ó·½¬O¥Ñ¨ä¥Lµ{¦¡²£¥Í¡A¤£¦b¤u§@ªíªºÀx¦s®æ¡C
    '¦¹¨Ò¼Æ¦C¦@¦³ 374 ­Ó¼Æ¦r¡A¹ê»Ú¤W¼Æ¦r¦Cªºªø«×¤£¤@©w¡C
    'ªþ¹Ï¦±½u¬O¦¹¨Ò¼Æ¦r¦Cªºªí¥Ü¡A¥Î¥H¤è«K»¡©ú¡C  
    '
Sub FindValley()
     Dim aa$, valley(2, 10) '¨¦ªº¦ì¸m&¨¦ªº¼Æ­È
     Dim ar, arr
     Dim i%
          '¼Æ¦r¦C
     aa = "451.8,452.5,453.8,454.4,454.7,455.1,455.6,455.9,457.2,459.1,460.8,463.3,466.7,469.5,471.9,474.2,476.3,"
     aa = aa & "478.4,480.1,481.5,482.4,483.3,483.4,484.3,484.9,485.6,485.7,485.8,485.7,485.3,485.3,485.7,485.8,485.9,486.3,"
     aa = aa & "486.4,486.7,487.3,488.2,488.6,489.1,489.6,490.1,490.4,489.5,488.6,487.2,485.7,485.6,483.9,483.2,482.1,481.2,"
     aa = aa & "479.5,478,477.2,474.5,472.1,467.2,463.3,460.5,458.5,455.1,440.2,430.5,420.3,415.2,400.2,375.1,350.5,336,"
     aa = aa & "328.5,320,308.5,306,305,303.5,302.5,301.2,300.5,301.3,302.1,303.5,306.3,307.6,309,315.5,318.7,320.1,328.7,"
     aa = aa & "335.6,345.5,350.1,352.5,361.3,364.2,365.8,367.4,368.2,370.5,375.3,380.2,384.7,386.4,390.2,395.4,400.8,"
     aa = aa & "408.7,415.2,425.6,440.5,445.8,450.5,457.3,459.1,460.5,462.1,462.3,463.5,465.3,465.5,466,467,467,467.1,467.6,467.8,"
     aa = aa & "467.6,467.7,467.8,467.9,467.8,467.4,466.9,466.1,465.7,465.1,464.4,463.9,463.3,462.6,461.6,460.7,460.2,"
     aa = aa & "459.4,458.3,457,455.9,454.5,453.2,450.5,447.9,445.2,442.6,440.4,438.3,435.6,432.8,430,427.4,424.6,421.4,"
     aa = aa & "417.9,414.5,410.8,407.4,404,401.4,398.8,396.2,393.3,390,386.9,383.9,380.8,"

     aa = aa & "377.5,374.3,371,367.7,364.6,362.1,360.3,358.7,357.1,355.4,353.4,351.3,349.6,347.9,346.2,344.4,342.7,341.2,339.7,"
     aa = aa & "338.4,336.8,335.5,334,332.3,330.3,328.4,326.6,324.9,323.2,321.7,320.4,319.2,317.7,316.5,315.2,315.1,"
     aa = aa & "315.2,315,315,314.9,314.7,314.5,314.3,314.3,314.4,314.7,315.1,315.4,315.7,315.9,316.1,316.2,316.3,316.8,"
     aa = aa & "317.3,317.9,318.5,319.2,319.9,320.4,320.9,321.1,320.8,320.2,319.7,319.1,318.6,318.2,317.8,317.4,316.8,316,"
     aa = aa & "315.3,314.8,314.4,314,313.6,313.1,312.3,311.6,311,310.3,309.7,309,308.2,307.1,305.9,304.2,302.4,300.5,298.7,"
     aa = aa & "296.8,294.8,292.8,290.7,289,287.3,286,284.9,283.7,282.4,281.2,280,278.6,277.2,275.8,274.3,272.6,271.1,269.7,"
     aa = aa & "268.1,266.6,265.1,263.3,261.6,259.7,257.4,254.9,252.5,250.1,247.7,245.2,243,240.8,238.7,236.6,234.6,232.7,230.9,"
     aa = aa & "229.1,227.2,225.4,223.7,222.1,220.4,218.8,217.3,216.1,215.2,214.4,213.6,212.9,212,211.4,210.8,210.3,209.9,210,"
     aa = aa & "210.3,210.6,211.2,211.8,212.7,213.3,213.9,214.5,214.6,214.3,214.4,214.5,214.6,214.7,215,215.5,215.8,216.3,216.9,"
     aa = aa & "217.3,217.8,218.6,219.3,220.5,221.8,223,224.1,225.4,"
     aa = aa & "226.9,228.4,229.7,231.2,233.1,234.9,236.9,238.8,240.7,242.4,244,245.5,247.1,248.8,250.6,252.3,254.1,255.6,"
     aa = aa & "257.2,258.7,259.7,260.6,261.4,262"
     
    'Âন°}¦C
     ar = Split(aa, ",")
     ReDim arr(UBound(ar))
     For i = 0 To UBound(ar) - 1
          arr(i + 1) = CSng(ar(i))
     Next
     
     '²Ä1§C¨¦ªº¼Æ¦r
     valley(1, 1) = Application.Small(arr, 1)
     
'¦p¦ó¼gVBAµ{§Ç¨D¨ú¥H¤Uªº¼Æ­È¡G
     '²Ä1§C¨¦ªº¦ì¸m valley(2,1)?
     
     '²Ä2§C¨¦ªº¼Æ¦r valley(1,2)?
     '²Ä2§C¨¦ªº¦ì¸m valley(2,2)?
     '²Ä3§C¨¦ªº¼Æ¦r valley(1,3)?
     '²Ä3§C¨¦ªº¦ì¸m valley(2,3)?


     '²Än§C¨¦ªº¼Æ¦r valley(1,n)?
     '²Än§C¨¦ªº¦ì¸m valley(2,n)?

End Sub

¥»©«³Ì«á¥Ñ Scott090 ©ó 2020-7-28 08:39 ½s¿è

¦^´_ 1# Scott090

     ½Ð°ª¤â¤j¤j­Ì¨ó§U¡A¦p¦ó¦b°}¦C¤¤·j´M¦U¨¦©³¦ì¸m¤Î¼Æ¦r¡AÁÂÁÂ
   

TOP

¥»©«³Ì«á¥Ñ n7822123 ©ó 2020-7-29 12:17 ½s¿è

¦^´_ 2# Scott090


§Ú´£¨Ñ¤@­Ó¤èªk¡A§A§â­ì°}¦Cªº­È¡A

¥Î«á¤@­Ó­È´î¥h«e¤@­Ó­È¡A°µ¦¨·s°}¦C

Á|¨Ò¨Ó»¡·s°}¦C=-8,-5,-3,-1,3,7,9

´M§ä"Åܸ¹"ªº¼Æ­È¦ì¸m¡A¥H¤W­±¨Ó»¡ ±q-1 Åܦ¨ 3

¨º»ò·s°}¦C­È -1ªº¦ì¸m¡A©Ò¹ïÀ³ªº­ì°}¦C¦ì¸m¡A

´N¬O·¥­È©Ò¦bªº¦ì¸m

¥Ñ­tÅÜ¥¿¡A³Ì«á¤@­Ó­t­È´N¬O¨¦©³¡A

¥Ñ¥¿ÅÜ­t¡A³Ì«á¤@­Ó¥¿­È´N¬O®p­È¡C

³o¬Oºtºâªkªº½dÃ¥¡A¦b³o¸ÌÀ³¸Ó¤£·|¦³¤HÀ°§A¼g....
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

¦^´_ 3# n7822123


    §Ú¥Î³o­Ó¤èªkºâ¤°¨Óªº,©M¥Lµ¹ªºµª®×¤£¤@¼Ë
¦ì¸m¡G¼Æ­È
80 300.5
128 467.6
211 315.1
322 209.9
333 214.3
­n¶Ü¥Lºâ¿ù,
¤£µM´N¬O´¶³qªººâªk¤£¾A¥Î¦bªÑ¥«ªºªi®ö²z½×?
¥i¯àÁٻݭn¥[¤W«Ü¦h±ø¥ó,©Î¬O¥Î§¹¥þ¤£¦Pªººtºâªk¨Ó¨D°ª§C­È

TOP

¥»©«³Ì«á¥Ñ n7822123 ©ó 2020-7-29 13:55 ½s¿è

¦^´_ 4# quickfixer


§A¥i¯àºâ¿ù¤F¡A§Ú­è­è¤@¤£¤p¤ß´N¼g§¹¤F..... ½Ö¥s§Ú¼ö·Rºtºâªk >.<

¤U¹Ï¬Ý¬Ý¬O¤£¬O§A­nªº¡A¤]¸ò§Aªº¹Ï¥Ü¤£¤@¼Ë¡A

¹Ï¥Ü²Ä2§CÂI¬O§Ú²Ä3§CÂI~~¹Ï¥Ü²Ä3§CÂI¬O§Ú²Ä4§CÂI.....§Úªº²Ä2§CÂI¤£¨£¤F!!

¤]³\¨º­Óºô­¶¦³¼{±¼³sÄò¥¿­t¼Æ­ÈÂà´«ªººtºâªk

ÁקK¾W³»»P¨¦©³¤Ó¹L±µªñ~~




¦³ÂI·ÐÂø¡A·Pı¥i¥H²¤Æ¡A¤£¹L§ÚÃiªº·Q¤F~~

¦³®É­Ô²¤Æ¤Ó¦h¡A¤Ï¦ÓÅܦ¨¤£ª½Ä±¡A¤£¦n¾\Ū

¦³¦Û¤v°µ¤@­Ó±Æ§Ç°}¦Cªº°Æ¨ç¼Æ¡A¥H§Aªºµ{«×À³¸Ó¬ÝªºÀ´~

µ{¦¡¦p¤U



Sub FindValley()
     Dim aa$, valley()
     Dim ar, Arr
     Dim i%
     
    '¼Æ¦r¦C
     aa = "451.8,452.5,453.8,454.4,454.7,455.1,455.6,455.9,457.2,459.1,460.8,463.3,466.7,469.5,471.9,474.2,476.3,"
     aa = aa & "478.4,480.1,481.5,482.4,483.3,483.4,484.3,484.9,485.6,485.7,485.8,485.7,485.3,485.3,485.7,485.8,485.9,486.3,"
     aa = aa & "486.4,486.7,487.3,488.2,488.6,489.1,489.6,490.1,490.4,489.5,488.6,487.2,485.7,485.6,483.9,483.2,482.1,481.2,"
     aa = aa & "479.5,478,477.2,474.5,472.1,467.2,463.3,460.5,458.5,455.1,440.2,430.5,420.3,415.2,400.2,375.1,350.5,336,"
     aa = aa & "328.5,320,308.5,306,305,303.5,302.5,301.2,300.5,301.3,302.1,303.5,306.3,307.6,309,315.5,318.7,320.1,328.7,"
     aa = aa & "335.6,345.5,350.1,352.5,361.3,364.2,365.8,367.4,368.2,370.5,375.3,380.2,384.7,386.4,390.2,395.4,400.8,"
     aa = aa & "408.7,415.2,425.6,440.5,445.8,450.5,457.3,459.1,460.5,462.1,462.3,463.5,465.3,465.5,466,467,467,467.1,467.6,467.8,"
     aa = aa & "467.6,467.7,467.8,467.9,467.8,467.4,466.9,466.1,465.7,465.1,464.4,463.9,463.3,462.6,461.6,460.7,460.2,"
     aa = aa & "459.4,458.3,457,455.9,454.5,453.2,450.5,447.9,445.2,442.6,440.4,438.3,435.6,432.8,430,427.4,424.6,421.4,"
     aa = aa & "417.9,414.5,410.8,407.4,404,401.4,398.8,396.2,393.3,390,386.9,383.9,380.8,"
     aa = aa & "377.5,374.3,371,367.7,364.6,362.1,360.3,358.7,357.1,355.4,353.4,351.3,349.6,347.9,346.2,344.4,342.7,341.2,339.7,"
     aa = aa & "338.4,336.8,335.5,334,332.3,330.3,328.4,326.6,324.9,323.2,321.7,320.4,319.2,317.7,316.5,315.2,315.1,"
     aa = aa & "315.2,315,315,314.9,314.7,314.5,314.3,314.3,314.4,314.7,315.1,315.4,315.7,315.9,316.1,316.2,316.3,316.8,"
     aa = aa & "317.3,317.9,318.5,319.2,319.9,320.4,320.9,321.1,320.8,320.2,319.7,319.1,318.6,318.2,317.8,317.4,316.8,316,"
     aa = aa & "315.3,314.8,314.4,314,313.6,313.1,312.3,311.6,311,310.3,309.7,309,308.2,307.1,305.9,304.2,302.4,300.5,298.7,"
     aa = aa & "296.8,294.8,292.8,290.7,289,287.3,286,284.9,283.7,282.4,281.2,280,278.6,277.2,275.8,274.3,272.6,271.1,269.7,"
     aa = aa & "268.1,266.6,265.1,263.3,261.6,259.7,257.4,254.9,252.5,250.1,247.7,245.2,243,240.8,238.7,236.6,234.6,232.7,230.9,"
     aa = aa & "229.1,227.2,225.4,223.7,222.1,220.4,218.8,217.3,216.1,215.2,214.4,213.6,212.9,212,211.4,210.8,210.3,209.9,210,"
     aa = aa & "210.3,210.6,211.2,211.8,212.7,213.3,213.9,214.5,214.6,214.3,214.4,214.5,214.6,214.7,215,215.5,215.8,216.3,216.9,"
     aa = aa & "217.3,217.8,218.6,219.3,220.5,221.8,223,224.1,225.4,"
     aa = aa & "226.9,228.4,229.7,231.2,233.1,234.9,236.9,238.8,240.7,242.4,244,245.5,247.1,248.8,250.6,252.3,254.1,255.6,"
     aa = aa & "257.2,258.7,259.7,260.6,261.4,262"
     
    'Âন°}¦C
     ar = Split(aa, ",")
     ReDim Arr(UBound(ar))
     For i = 0 To UBound(ar) - 1
          Arr(i + 1) = CSng(ar(i))
     Next
     
     '«á¤@­È´î«e¤@­È°}¦C-Brr
     ReDim Brr(UBound(Arr))
     For i = 2 To UBound(Arr)
         Brr(i) = Arr(i) - Arr(i - 1)
     Next
     
     '§ä·¥­È¦ì¸m
     For i = 2 To UBound(Brr) - 1
         If Brr(i) >= 0 And Brr(i + 1) < 0 Then ®p¦ì = ®p¦ì & "," & i
         If Brr(i) < 0 And Brr(i + 1) >= 0 Then ¨¦¦ì = ¨¦¦ì & "," & i
     Next
      
    'Âà°}¦C
    ®p¦ìArr = Split(Mid(®p¦ì, 2), ",")
    ¨¦¦ìArr = Split(Mid(¨¦¦ì, 2), ",")
   
    '¥Î¦ì¸m°}¦C±o¼Æ­È°}¦C
    ReDim ®p­ÈArr(UBound(®p¦ìArr))
    For i = 0 To UBound(®p¦ìArr)
        ®p­ÈArr(i) = Arr(®p¦ìArr(i))
    Next
    ReDim ¨¦­ÈArr(UBound(¨¦¦ìArr))
    For i = 0 To UBound(¨¦¦ìArr)
        ¨¦­ÈArr(i) = Arr(¨¦¦ìArr(i))
    Next
     
    '¨Ì¾W­ÈArrªº­È§â¾W¦ìArr°µ±Æ§Ç (¤j>¤p)
    ®p¦ìArr = ArrSortBrr(®p­ÈArr, True, ®p¦ìArr)
    '¨Ì¨¦­ÈArrªº­È§â¨¦¦ìArr°µ±Æ§Ç (¤p>¤j)
    ¨¦¦ìArr = ArrSortBrr(¨¦­ÈArr, False, ¨¦¦ìArr)
   
    ReDim valley(2, UBound(¨¦¦ìArr) + 1)  '¨¦ªº¦ì¸m&¨¦ªº¼Æ­È
   
    For i = 0 To UBound(¨¦¦ìArr)
      valley(2, i + 1) = ¨¦¦ìArr(i)            '¦ì¸m
      valley(1, i + 1) = Arr(¨¦¦ìArr(i))    '¼Æ­È
    Next
   
    For i = 1 To UBound(valley, 2)
        Debug.Print "²Ä" & i & "§C¨¦¼Æ­È=" & valley(1, i) & " ; ²Ä" & i & "§C¨¦¦ì¸m=" & valley(2, i)
    Next

End Sub

Function ArrSortBrr(ByVal Arr, Order, ByVal Brr)
'¥ÎArr°}¦Cªº¸ê®Æ¶¶§Ç¨Ó±Æ§ÇBrr
For i = LBound(Arr) To UBound(Arr) - 1
  For j = i + 1 To UBound(Arr)
    If Order Then   '¤j > ¤p
      If Arr(j) > Arr(i) Then
        T = Arr(i): Arr(i) = Arr(j): Arr(j) = T
        T = Brr(i): Brr(i) = Brr(j): Brr(j) = T
      End If
    Else                    ' ¤p > ¤j
      If Arr(j) < Arr(i) Then
        T = Arr(i): Arr(i) = Arr(j): Arr(j) = T
        T = Brr(i): Brr(i) = Brr(j): Brr(j) = T
      End If
    End If
  Next j
Next i
ArrSortBrr = Brr
End Function
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

¥»©«³Ì«á¥Ñ quickfixer ©ó 2020-7-30 00:48 ½s¿è

¦^´_ 5# n7822123


    ÁÂÁ§A´£¨Ñ½d¨Ò±Ð¾Ç
§Ú§ï¥Î¨ç¼Æ­«²{¹Lµ{XD
´ú¸Õ«á,­ì¨Ó§Úªº±ø¥ó¬O<0¡B >0 ¡A§Ú§ï¦¨>=0,´N©M§Aªºµ²ªG¤@¼Ë¤F


¤Ö¤F31¡B214¡B219,³o3­Ó¦ì¸m
´N¹³§A»¡ªº¤@¼Ë,¤£¬O³æ¯Â¥u¦³§ä°ª§C¼Æ­È,ÁÙ¦³¥Î¥¼ª¾ªº¯S©w±ø¥ó¥h¹LÂo±¼(¼W¥[)¤@¨Ç¼Æ­È

Image 39.png

Image 40.png

TOP

¦^´_ 5# n7822123
¦^´_ 6# quickfixer

   ÁÂÁÂ2¦ì°ª¤â¤j¤jªº«ü¾É
    ¦Û·í²`¤J¤F¸Ñ¶Qºtºâªk»P¤w´¦ÅSªºµ{¦¡½X

   ¦A¤T·P®¦

TOP

        ÀR«ä¦Û¦b : ­ì½Ì§O¤H´N¬Oµ½«Ý¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD