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

[µo°Ý] ³sÄòNµ§¸ê®Æ§P§O

¨ä¹ê¦³¨Ç¼gªk§Ú¯uªº¬Ý¤£À´
¦ý§Ú³£¥Î´ú¸Õªº¤è¦¡¨Ó²z¸Ñ¦U¦ìªº»y¨¥
VBA¯u¬O¤@±ø¤£Âk¸ô (»~
²öÅý¥L¤H¿ù»~¶Ë®`¦Û¤v

TOP

¦^´_  ­ã´£³¡ªL

·PÁ·ǤjªÈ¥¿XD

¨ä¹ê§Ú¤wµo²{°ÝÃD¤F¡A¥u¬OÃiªº§ï~

·Q»¡Åª¸ê®Æ»P¼g¸ê®Æ³£¥Î¦P¤@­Ó ...
n7822123 µoªí©ó 2021-1-1 16:33



If Brr(R, 1) <> T Then T = Brr(R, 1): S = T
³o¤@¦æ§ÚŪ¤£À´
´ú¸Õ¦pªG§â¥¦²¾°£¡A´N¤£·|¥X²{"³sÄò¤p" ªº¼Ð°O¸ò°T®§
Brr(R, 1) <> T ( T¬O±q¦ó¦Ó¨Ó?
²öÅý¥L¤H¿ù»~¶Ë®`¦Û¤v

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2021-1-6 23:57 ½s¿è
If Brr(R, 1)  T Then T = Brr(R, 1): S = T
If Brr(R, 1) <> T Then T = Brr(R, 1): S = T
³o¤@¦æ§ÚŪ¤£À´
´ú¸Õ¦pªG§â¥¦²¾°£¡A´N¤£·|¥X²{"³sÄò¤p" ªº¼Ð°O¸ò°T®§
Brr(R, 1) <> T ( T¬O±q¦ó¦Ó¨Ó?
y54161212 µoªí©ó 2021-1-6 14:43

³oºØ¤ñ¸û²³æªº·§©À§Ú´N¥N³Ò¤@¤U:
µ{¦¡¶}ÀY´N©w¸q¤F T% ªí¥Ü¥¦¬O­Ó¾ã¼Æ,
¤@¶}©l¨S¯S§O¥h½á­È®É¹w³]­È¬O0,
¤]´N¬O»¡²Ä1¦¸¬O¸ò0¤ñ¸û.

  Brr(R, 1) = IIf(Arr(R, 1) > CL, 1, -1) ' ¤ñ¸û«á«ü©w¥[´î¼Æ
  S = S + Brr(R, 1) ' ¤j©ó®É + 1, ¤p©ó®É - 1, ¥[¨ì +8 ©Î -8 ®É´N¬O³sÄò8¦¸ ¤j©ó ©Î ¤p©ó ¤F
  If S = N Then ³sÄò¤j = True: S = S - 1: Brr(R, 2) = 1  ' ³o¸Ì¬O "¤j©ó" °Ï S=8«á S=S-1 ´NÅܦ^ 7, ¤U¦¸¦A¥[1´N¤S=8 ¥i¦A¦¸Ä²µo¥»¦æªº±ø¥ó
  If S = -N Then ³sÄò¤p = True: S = S + 1: Brr(R, 3) = 1 ' "¤p©ó" °Ï, ­ì²z¦P¤W.
  If Brr(R, 1) <> T Then T = Brr(R, 1): S = T  ' ¨ä¹ê´N¬O«O¦s¥»¦¸ªº­È¥H³Æ¤U¤@¦¸¤ñ¸û¬O¤£¬O­È¤£¦P¤F¥Î.

³o¸Ì¶¶«K¤]´£¨Ñ¤@¤U§Ú·í®É­×§ï«áªº¸Ñªk, (¥H3#°µ¥Àª©­×§ï)
¹Á¸Õ§ï¦¨Åã¥Ü 0 ¦Ó¤£¬O -1 §@¹ê²{.
  1. Sub §PÂ_«~½è²§±`()
  2. Const N = 7   '³]©w³sÄò¦¸¼Æ
  3. Dim Rn&, R%, S%, T%, CL!
  4. Dim ³sÄò¤j As Boolean, ³sÄò¤p As Boolean
  5. Rn = Cells(Rows.Count, 1).End(xlUp).Row - 2
  6. If Rn < 1 Then Exit Sub
  7. CL = [C1]
  8. With [C3].Resize(Rn, 3)
  9.   Arr = .Offset(, -2).Resize(, 5).Value
  10.   .ClearContents
  11. End With
  12. For R = 1 To Rn
  13.   Arr(R, 3) = IIf(Arr(R, 1) > CL, 1, 0)
  14.   S = S + (Arr(R, 3) = 0) * 2 + 1
  15.   If S = N Then S = S - 1: ³sÄò¤j = True: Arr(R, 4) = 1
  16.   If S = -N Then S = S + 1: ³sÄò¤p = True: Arr(R, 5) = 1
  17.   If Arr(R, 3) <> T Then T = Arr(R, 3): S = T
  18. Next R
  19. [A3].Resize(Rn, 5) = Arr
  20. If ³sÄò¤j Then MsgBox "³sÄò7ÂI¦b¤¤¤ß½u¦P°¼(¤j©ó)"
  21. If ³sÄò¤p Then MsgBox "³sÄò7ÂI¦b¤¤¤ß½u¦P°¼(¤p©ó)"
  22. End Sub
½Æ»s¥N½X

TOP

³oºØ¤ñ¸û²³æªº·§©À§Ú´N¥N³Ò¤@¤U:
µ{¦¡¶}ÀY´N©w¸q¤F T% ªí¥Ü¥¦¬O­Ó¾ã¼Æ,
¤@¶}©l¨S¯S§O¥h½á­È®É¹w³]­È¬O ...
luhpro µoªí©ó 2021-1-6 23:32



  Brr(R, 1) = IIf(Arr(R, 1) > CL, 1, -1)
  S = S + Brr(R, 1) : MsgBox S
'If S = N Then ³sÄò¤j = True: S = S - 1: Brr(R, 2) = 1  
'If S = -N Then ³sÄò¤p = True: S = S + 1: Brr(R, 3) = 1 '
  If Brr(R, 1) <> T Then T = Brr(R, 1) : MsgBox T: S = T  :MsgBox S

¬Q¤Ñ¥Î³oºØ¤è¦¡
²×©ó·dÀ´¤F³Ì«á¤@¦æªº·N¸q....

ÁÂÁ±zªº¨ó§U½s¼gµù¸Ñ
²öÅý¥L¤H¿ù»~¶Ë®`¦Û¤v

TOP

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