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

[µo°Ý] ½Ð¥ý¶i­Ì¨ó§U°»¿ù

[µo°Ý] ½Ð¥ý¶i­Ì¨ó§U°»¿ù

[ª©¥DºÞ²z¯d¨¥]
  • GBKEE(2018/9/3 14:10): §Aªºµ{¦¡½X¤£§¹¾ã,³Ì¦nªþ¤WÀɮרÓ

  1. Sub Pattern(Rng As Range, xCode, xDate As Range)
  2.     Dim H As Range, L As Range, C As Range, rh As Range, rl As Range
  3.     Dim Tf1 As Boolean, Tf2 As Boolean
  4.     Dim i, j, k, th, tl, sw
  5.     i = 0: j = 0: k = 0
  6.     th = 0: tl = 0: sw = 0
  7.     Do While i < 8 '¨ú6­ÓÂI
  8.         Set H = grabData("°ª", xCode, xDate).Offset(0, j)
  9.         Set L = grabData("§C", xCode, xDate).Offset(0, j)
  10.         Set C = grabData("¦¬", xCode, xDate).Offset(0, j)
  11.         If j > 300 Then Exit Do '­­¨î¸ê®Æ®w½d³ò
  12.         If C <> "" Then
  13.             k = k + 1 '­p¼Æ
  14.             If k = 1 Then GoSub RefreshHL
  15.             Tf1 = sw >= 0 And C < tl * 0.9
  16.             Tf2 = sw <= 0 And C > th * 1.1
  17.             If Tf1 Or Tf2 Then
  18.                 GoSub MoveAndSwitch
  19.                 GoSub WriteDataIn
  20.                 GoSub RefreshHL
  21.             Else
  22.                 Set rh = IIf(H > rh, H, rh)
  23.                 Set rl = IIf(L < rl, L, rl)
  24.                 th = IIf(H < th, H, th)
  25.                 tl = IIf(L > tl, L, tl)
  26.                 GoSub WriteDataIn
  27.             End If
  28.         End If        
  29.         Debug.Print sw & "_" & j & "_" & k & "_" & i
  30.         j = j + 1
  31.     Loop
  32. Exit Sub
½Æ»s¥N½X
¦bdo while°j°é¤º¡Adebug.printªºµ²ªG¡Aj³£¬O±q102¶}©l¡A¤£ª¾¹D¬O­þ¸Ì¿ù¤F
½Ð¤j®aÀ°¦£¬Ý¬Ý
ÁÂÁ¤j®a
¤£¶i«h°h

«Øij§A¥ý¥Î¡uºÊ¬Ý¦¡¡v°lÂÜ¡A
¦]¬°§Aµ{¦¡¸Ì­±ÁÙ¦³¨ä¥Lµ{§Ç°ÑÂø¨ä¤¤¡A
§Ú§â¨ä¥Lµ{§Ç®³±¼«á¨Ã¨S¦³µo²{²§ª¬¡C

TOP

¥»©«³Ì«á¥Ñ mnsmrtl ©ó 2018-9-3 15:38 ½s¿è
  1. Sub Ac§ìĵ¥Ü()
  2.     Call GetAlarm(1)
  3. End Sub

  4. Sub GetAlarm(Nd)
  5.     Dim xRow%, xCode, xDate As Range, i, j, writeIn As Range
  6.     Call AÃö³¬
  7.     xRow = Sheets("°ò¥»").[A1].End(xlDown).Row
  8.     For i = 2 To xRow
  9.         With Sheets("°ò¥»")
  10.             xCode = .Cells(i, "A")
  11.             Set writeIn = .Range(.Cells(i, "C"), .Cells(i, "T")) '«¬ºA°ª§C    ¼g¤J¸ê®Æ½d³ò
  12.         End With
  13.         Set xDate = Sheets("¦¬").Cells(1, 3).Offset(0, Nd - 1) '®Ú¾Ú°Ñ¼Æ­×§ï°_©l¤Ñ¼Æ
  14.         Call Pattern(writeIn, xCode, xDate)
  15.     Next i
  16.     Call A¶}±Ò
  17. End Sub

  18. Function grabData(Sht$, xCode, xDate As Range) '±q¸ê®Æ®w§ì¨ú¼Æ¾Ú
  19.     Dim matC, matD
  20.     With Sheets(Sht)
  21.         matC = WorksheetFunction.Match(xCode, .Columns(1), 0)
  22.         matD = WorksheetFunction.Match(xDate, .Rows(1), 0)
  23.         Set grabData = .Cells(matC, matD)
  24.     End With
  25. End Function

  26. Function fbdate(Rng As Range) '«öÀx¦s®æ§ä¡u¤é´Á¡v
  27.     Set fbdate = Sheets(Rng.Worksheet.Name).Cells(1, Rng.Column)
  28. End Function

  29. Sub Pattern(Rng As Range, xCode, xDate As Range)
  30.     Dim H As Range, L As Range, C As Range, rh As Range, rl As Range
  31.     Dim Tf1 As Boolean, Tf2 As Boolean
  32.     Dim i, j, k, th, tl, sw
  33.     Rng.ClearContents
  34.     i = 0: j = 0: k = 0
  35.     th = 0: tl = 0: sw = 0
  36.     Do While i < 8 '¨ú6­ÓÂI
  37.         Set H = grabData("°ª", xCode, xDate).Offset(0, j)
  38.         Set L = grabData("§C", xCode, xDate).Offset(0, j)
  39.         Set C = grabData("¦¬", xCode, xDate).Offset(0, j)
  40.         If j > 300 Then Exit Do '­­¨î¸ê®Æ®w½d³ò
  41.         If C <> "" Then
  42.             k = k + 1 '­p¼Æ
  43.             If k = 1 Then GoSub RefreshHL
  44.             Tf1 = sw >= 0 And C < tl * 0.9
  45.             Tf2 = sw <= 0 And C > th * 1.1
  46.             If Tf1 Or Tf2 Then
  47.                 GoSub MoveAndSwitch
  48.                 GoSub WriteDataIn
  49.                 GoSub RefreshHL
  50.             Else
  51.                 Set rh = IIf(H > rh, H, rh)
  52.                 Set rl = IIf(L < rl, L, rl)
  53.                 th = IIf(H < th, H, th)
  54.                 tl = IIf(L > tl, L, tl)
  55.                 GoSub WriteDataIn
  56.             End If
  57.         End If
  58.         Debug.Print H.Column
  59.         j = j + 1
  60.     Loop
  61. Exit Sub
  62. MoveAndSwitch:
  63.     i = i + 1
  64.     sw = IIf(sw >= 0, -1, 1)
  65.     Return
  66. WriteDataIn:
  67.     If i < 7 And i > 0 Then
  68.         Rng(i) = IIf(sw = 1, rh, rl)
  69.         Rng(i + 6) = fbdate(IIf(sw = 1, rh, rl))
  70.         Rng(i + 12) = k
  71.     End If
  72.     Return
  73. RefreshHL:
  74.     Set rh = H
  75.     Set rl = L
  76.     th = H
  77.     tl = L
  78.     Return
  79. End Sub
½Æ»s¥N½X
¦]¬°ÀÉ®×À£ÁY«á¤]¬O¶W¹L1MB¡A©Ò¥H§Ú§â¦³¥Î¨ìªºµ{¦¡½X¶°¤¤©ñ¤@°_¦A¶K¤@¦¸
¹ï©óÅܼÆJ¡A¦b¨ä¥Lµ{§Ç¨S¦³°µ¤°»ò°Ê§@
Àɮפº¡A¬O¦UªÑ²¼ªº¨C¤é¶}½L¥|»ù¤Î¦¨¥æ¶q
¦p¹Ï


ºÊ¬Ý¦¡ªº³¡¤À¡A§Ú­n¦A¬d¤@¤U¸ê®Æ¡A¬Ý«ç»ò¥Î¡KÁÂÁ¼ӤW«üÂI

¤W¶Ç¨ìMEGAªÅ¶¡¤F¡A¤j¬ù15M¡Aºô§}¦p¤U
https://mega.nz/#!uTZkGI4K!XtnUzYtIyzsHBFPNF4hGrcroUtzdO8UthkdFSorPVxk
¤£¶i«h°h

TOP

¦^´_ 3# mnsmrtl

ºÊ¬Ý¦¡ªº¤è¦¡¦p¤U¹Ï¡A


¦ý§Ú´ú¸Õ¤U¨Ó¨Ã¨S¦³µo²{¥ô¦ó²§ª¬¡A
§ÚµLªk­«²{§Aªº°ÝÃD¡C

TOP

¤£ª¾¹D­þ¥X¤F°ÝÃD¡A§Úª©¥»¬O2007¡A¤£ª¾¹D¸ò³o¦³¨S¦³Ãö«Y
¤£¶i«h°h

TOP

¦^´_ 5# mnsmrtl

ºÊ¬Ý¬O°w¹ïÅܼưµºÊ¬Ý¡A
©Ò¥H¦pªG§A·Q­nºÊ¬Ý§A¹Ï¤¤ªº°T®§ªº¸Ü¡A
§A»Ý­n§âDebug.Print ¥h±¼

TOP

¦^´_ 6# a5007185

¸g­×§ï«á¡A§Úµo²{µ{¦¡¦³°õ¦æ¡A¦ý¬Odebug.Print¥¼Åã¥Ü
¤£ª¾¹D¬O­þ¥X¤F°ÝÃD¡AÁÂÁ¼ӤW«ü¾É
¤£¶i«h°h

TOP

¦^´_ 7# mnsmrtl


­ìµ{¦¡½X¤£»Ý­n§ó°Ê¡A
§Úªº·N«ä¬O»¡§A¦b¶i¦æºÊ¬Ýªº®É­Ô¡A
»Ý­n§âDebug.Print¥h±¼¡C

¥Ü½d.gif

TOP

¦^´_ 8# a5007185

«z®@¡AÁÙÅý±z°µ¼v¤ù¡A¯u¤£¦n·N«ä
ºÊ¬Ý¦¡°ÝÃD¤w¸Ñ¨M¡A¤£¹L¦b§Y®É¹Bºâµøµ¡¤º¡A¨ÌµM¥uÅã¥Ü102¤§«á
¦ý¼g¤JÀx¦s®æªº³¡¤À¡A½T¹ê¦³100¥H¤ºªº
¥i¯à¬OÅã¥Ü°ÝÃD¡A©Î¬O°O¾ÐÅ餣¨¬§a¡K¡H

ºô¸ô¤Wªº¤å³¹¬O¦³´£¹L¡A¦³¥i¯à¦]¬°­È¤£¦s¦b¡A©Ò¥H¨SÅã¥Ü¥X¨Ó
©Î³\¬O¨ä¤¤¤@­ÓÅܼƨì102¤§«á¤~¦³¡H

Á`¤§¡A¤ñ¹ïÀx¦s®æªº¤º®e¤§«á¡A§Úµo²{µ{§ÇªºÅÞ¿è¤]¤£¤Ó¹ï¡A©Ò¥H¾ã­Ó³£­×§ï¤F
¥Ø«e¤w¨S¦³°ÝÃD¡AÁÂÁ±zªºÀ°§U¡A·P®¦
¤£¶i«h°h

TOP

¦^´_ 9# mnsmrtl

§Ú·Q§Aµ{¦¡À³¸Ó³£¬O¥¿±`¹B§@ªº¡A
¥u¤£¹L¦]¬°¡u§Y®É¹Bºâ¡v®e¯Ç¤£¤F³o»ò¦h¸ê®Æ¡A
©Ò¥H§â¤@³¡¤À¸ê®Æ¦Y±¼¤F¡C

1536132491740.gif
§Ú¼g¤F²©öªº°j°é¡A
Åý¥L¦R¥X250¦æ¸ê®Æ¡A
©Ô¨ì³»¥u³Ñ¤U52¦æ¡A
§Úªº±À´ú¬O¡u§Y®É¹Bºâ¡v³Ì¦h¯à°÷®e¯Ç200¦æ¸ê®Æ¡A
­è­èªº´ú¸Õ·í¤¤¥[¤W©³¤UªÅ¥Õ2¦æ¡A«ê¦n´N¬O200¦æ¡A
¥H¤Wµ¹§A°µ­Ó°Ñ¦Ò¡C

¥t¥~«Øij§A¥i¥H§Q¥ÎF8ªº¥\¯à³v¨B°õ¦æµ{¦¡¦b·f°t¡uºÊ¬Ý¦¡¡v¡A
³o¼Ë§A´N¥i¥H¤F¸Ñ¾ã­Óµ{¦¡¨C­ÓÅܼƪº¹B§@¤F¡C
§Æ±æ¥H¤W¥i¥HÀ°§U¨ì§A¡C

TOP

        ÀR«ä¦Û¦b : §g¤l¦p¤ô¡AÀH¤è´N¶ê¡AµL³B¤£¦Û¦b¡C
ªð¦^¦Cªí ¤W¤@¥DÃD