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

[µo°Ý] VBA_½Ð²¤Æµ{¦¡½X¡CÁÂÁÂ!

¥»©«³Ì«á¥Ñ Airman ©ó 2015-11-23 10:24 ½s¿è

¦^´_ 20# GBKEE
GBKEE¶W¤j:
¤£¦n·N«ä¡A¦³ÂI»~®t~¦ý¤£¦n»¡©ú¡A¤p§ÌºÉ¤O´N¬O~
07,39¥u¬OÁ|¨Ò²Å¦X½d¨Ò¤¤¤§´Á¼Æªº¥æ¶°¼Æ¦r¡A~©Ò¥H¥æ¶°¼Æ¦r¬O¨Ì¾Ú¦³¼Æ¦rªºTÄ椧¹ïÀ³RÄæ´Á¼Æ¦ÓÅܤơC

¦]¦¹~¤p§Ì±N¦C12§ï¬°:
For Each E In Array(.Range("R" & b.Row).Value, .Range("R" & b.Row) - .[T3], .Range("R" & b.Row) - .[T3] * 2) '´Á§Oªº°j°é
µ{¦¡´N¤¤Â_¤F¡C

½Ð±Ð:
x_No = Array(7, 39)©M"´Á§Oªº°j°é"©Î¨ä¥¦¬ÛÃöªºµ{¦¡½XÀ³¦p¦ó¦A­×¥¿?
·q½Ð½ç¥¿!ÁÂÁ±z:lol

PS:¥æ¶°ªº¼Æ¦r½d³ò:01~49¡C¥i¯à¦³1­Ó¡A¥i¯à¦³2­Ó¡A....³Ì¦h7­Ó¡C

TOP

¦^´_ 21# Airman
§A·Q­n¬Y¤@´Á¼Æ¤¤¶}¥Xªº¸¹½X(³Ì¦h7­Ó)©Î¬O«ü©wªº¸¹½X,¦b¤U´X´Á¤¤¼Ð¥XÃC¦â
¼Æ¦r½d³ò:01~49¡C¥i¯à¦³1­Ó¡A¥i¯à¦³2­Ó¡A....³Ì¦h7­Ó¡C   
©Ò¥H¥æ¶°¼Æ¦r¬O¨Ì¾Ú¦³¼Æ¦rªºTÄ椧¹ïÀ³RÄæ´Á¼Æ¦ÓÅܤÆ

§Aªº³W«ßÅÞ¿è ,ªþÀɤ¤¥i«ü©ú¶Ü? »¡²M·¡.


  1. For Each E In Array(.Range("R" & b.Row).Value, .Range("R" & b.Row) - .[T3], .Range("R" & b.Row) - .[T3] * 2)
½Æ»s¥N½X

¨Sµ{¦¡½X¬Ý¤£À´ ,
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 22# GBKEE
  ´N¦pªþÀɤ¤ªº¦C19~¦C33
For i = 10 To 16
   For j = 10 To 16
    For k = 10 To 16
           If .Cells(.Range("R" & b.Row) + 6, i) = .Cells(.Range("R" & b.Row) - .[T3] + 6, j Then
           If .Cells(.Range("R" & b.Row) + 6, i) = .Cells(.Range("R" & b.Row) - .[T3] * 2 + 6, k) Then
           If .Cells(.Range("R" & b.Row) - .[T3] + 6, j) = .Cells(.Range("R" & b.Row) - .[T3] * 2 + 6, k) Then
              .Cells(.Range("R" & b.Row) + 6, i).Interior.ColorIndex = 4
              .Cells(.Range("R" & b.Row) - .[T3] + 6, j).Interior.ColorIndex = 45
              .Cells(.Range("R" & b.Row) - .[T3] * 2 + 6, k).Interior.ColorIndex = 8
           End If
           End If
           End If

²³æªº»¡:´N¬O±N¤W­zµ{¦¡½Xªº»Ý¨D¤Æ¬°¶Qµ{¦¡½X~µM«á±N¤W­zªºµ{¦¡½X²¾°£§Y¥i¡C

¥i¯à¬O¦]¬°¶Qµ{¦¡½X¤Ö¤FÃþ¦ü#11ªºµ{¦¡½X~
Application.Goto .Range("T7:T" & .[R7].End(xlDown).Row)

For Each b In Selection
If b <> "" Then
...
Next b
©Ò¥H(.Range("R" & b.Row) ®M¤£¶i¥h¶Qµ{¦¡¤¤¤§"´Á§Oªº°j°é"~
¤p§ÌVBAªì¾Ç¡A¥u¬O²q´ú¥i¯àªº­ì¦]~¤£´±´N¦¹¦kÂ_

¥H¤W ÂԨѰѦÒ!ÁÂÁ±z!

TOP

¦^´_ 14# Airman


If R(y) Is Nothing Then U = 1: Exit For
©³¤U¥[¤@¦æ¡G
If y > 1 Then If R(y).Column <> R(y-1).Column Then U = 1: Exit For¡@'¤T°Ï¥ô¤@Äæ¦ì¤£¦P¡@

TOP

¦^´_ 24# ­ã´£³¡ªL
­ã¤j:
´ú¸ÕOK¤F~·P®¦
¤p§Ì¥H¬°­n§ï¬°Offset¡A§Ë¤F¦Ñ¥b¤Ñ¡A´N¬O¶]¤£¥Xµ²ªG

#15¥i§_½Ð±z¦A¦¸«ü¾É~ÁÂÁ±z

TOP

¦^´_ 23# Airman

Áö¦³­ì¨Óªºµ{¦¡½X¡A¨S¦³¤å¦r¸Ô²Ó»¡©ú³W«h¡A¤ÎÁ|¹ê¨Ò»¡©ú¡A¶WªOÀ³«Ü¤£¦n¤U¤â¥h°µÂ²¤Æ¡F

µ{¦¡½X¦Û¤v¼gªº¡A¦Û¤v¬Ý±oÀ´¡A­n­×§ï®ÉÁÙ¦³­Ó¤U¤â³B¡A©Ò¥H¤p´T­×§ï¦p¤U¡G
For i = 10 To 16:  For j = 10 To 16:  For k = 10 To 16
¡@¡@If .Cells(b(1, -1) + 6, i) = .Cells(b(1, -1) - .[T3] + 6, j) And _
¡@¡@¡@¡@.Cells(b(1, -1) + 6, i) = .Cells(b(1, -1) - .[T3] * 2 + 6, k) Then
¡@¡@¡@¡@.Cells(b(1, -1) + 6, i).Interior.ColorIndex = 4
¡@¡@¡@¡@.Cells(b(1, -1) - .[T3] + 6, j).Interior.ColorIndex = 45
¡@¡@¡@¡@.Cells(b(1, -1) - .[T3] * 2 + 6, k).Interior.ColorIndex = 8
¡@¡@End If
Next k:  Next j:  Next i

¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×¡×
.Cells(.Range("R" & b.Row) + 6, i)¡@§ï¦¨¡@.Cells(b(1, -1) + 6, i)¡@¡Äb®æ©¹¥ª¢±®æ§Y¬°¢àÄ檺´Á¼Æ®æ
¢²­ÓIf§ï¦¨¢±­Ó§Y¥i¡AA=B and A=C¡@§Y¥²©wA=C

TOP

¦^´_ 23# Airman

­Y­n¢²¦C¦PÄæ¬Û¦P¡G
For i = 10 To 16
¡@¡@If .Cells(b(1, -1) + 6, i) = .Cells(b(1, -1) - .[T3] + 6, i) And _
¡@¡@¡@¡@.Cells(b(1, -1) + 6, i) = .Cells(b(1, -1) - .[T3] * 2 + 6, i) Then
¡@¡@¡@¡@.Cells(b(1, -1) + 6, i).Interior.ColorIndex = 4
¡@¡@¡@¡@.Cells(b(1, -1) - .[T3] + 6, i).Interior.ColorIndex = 45
¡@¡@¡@¡@.Cells(b(1, -1) - .[T3] * 2 + 6, i).Interior.ColorIndex = 8
¡@¡@End If
Next i

TOP

¥»©«³Ì«á¥Ñ Airman ©ó 2015-11-24 01:44 ½s¿è

¦^´_ 27# ­ã´£³¡ªL
­ã¤j:
·PÁ±zªº½ç±Ð!¦h¾Ç²ß¤F¥tºØµ{¦¡¼gªk¡C·P®¦:lol

"µ{¦¡½X¦Û¤v¼gªº¡A¦Û¤v¬Ý±oÀ´"
¤p§Ì¥i¯à¬O¦b"»{ª¾¤W"¦³»~¸Ñ¤F~¶Wª©¤j³£¤w¸g¬Ý±oÀ´¶Q»yªk~
¦]¬°¦Û¤vı±o¤p§Ì¼gªº¬O³Ì²Ê²L¤@±ø¤@±ø³v±ø±Ô­zªº»yªk¡A¦Ó¥B¦³½d¨Ò¡A¥H¬°¤j®aÀ³¸Ó³£¬Ý±oÀ´¡A©Ò¥H¨S¦³¦A¥[µù~
³o¤@ÂI¸g±z¤@»¡¡A¹ï¶Wª©¤j²`ı©êºp!¦b¦¹¯S¦V¶Wª©¤jÂÔ­Pºp·N:L

¨ä¹ê³o¦¸·|·Q²¤Æµ{¦¡½X¡A°_¦]¬O·Q¾¨¶q¤Ö¥Î°j°é¡A°£¤F´£¤É°õ¦æ®Ä²v¤]´î¤ÖÅܼƱo¨Ï¥Î¡A¦AªÌ¬O«ôŪ±z²¤Æªº»yªk«á¡Aı±o«Ü±µªñAª¾ÃѪøªº¼gªk~
¥B§ó²§ã©öÀ´¡AµM«á¤S«ôŪ¶Wª©¤jªº»yªk¡A¤S§ó²§c¡A©Ò¥H¤~¤S±N¥æ¶°­È»yªk´£¥X²¤Æ»Ý¨D~
µ¹¤G¦ì¥ý¶i²K³Â·Ð¡A²`·P¤£¦w¡A·q½Ð²[½Ì!

TOP

¥»©«³Ì«á¥Ñ Airman ©ó 2015-11-24 03:07 ½s¿è

¦^´_ 22# GBKEE
¶Wª©¤j:
©êºp!¤p§Ìı±o¦Û¤v¼gªº¬O³Ì²Ê²L¤@±ø¤@±ø³v±ø±Ô­zªº»yªk¡A¦Ó¥B¦³½d¨Ò¡A©Ò¥H¨S¦³¦A¥[µù~¤£¹î¤§³B¡A·q½Ð²[¶q:L

¤p§Ì¦³±N¶Qµ{¦¡¹Á¸Õ²K­×~
        Sheets(1).Range("J7", "P" & Sheets(2).[R6] + 5).Copy .[J7]

        'Set Rng = .Range("T7:T" & .[R7].End(xlDown).Row)        
       Application.Goto .Range("T7:T" & .[R7].End(xlDown).Row)        
        For Each b In Selection
        
         If b <> "" Then        
        E = Array(.Range("R" & b.Row).Value, .Range("R" & b.Row) - .[T3], .Range("R" & b.Row) - .[T3] * 2) '´Á§Oªº°}¦C

            For Each x In x_No   '¤ñ¹ï¼Æ¦rªº°j°é             .
              ......
             ......
         End If
       Next b

¦ý¦]¤£ª¾ x_No = Array(7, 39)µ¥¥æ¶°¼Æ¦rªº¬ÛÃö»yªk­n«ç»ò§ï?©Ò¥H¥u³o¼Ë²K¥[~µ{¦¡·|¤¤Â_¦bFor Each x In x_No

¥æ¶°¼Æ¦r¨ú±oªºÅÞ¿è¡J
·íTÄ榳Åã¥Ü¼Æ¦rªºÀx¦s®æ¡A¥B·í¨ä¦bRÄ檺¹ïÀ³´Á¼Æ(§Y.Range("R" & b.Row))¤Î¸ÓRÄ檺¹ïÀ³´Á¼Æ-T$3(§Y.Range("R" & b.Row)-T$3)¤Î¸ÓRÄ檺¹ïÀ³´Á¼Æ-T$3*2(§Y.Range("R" & b.Row)-T$3*2)µ¥3­Ó´Á¼Æ¦P®É³£¦³¬Û¦P¼Æ¦r¡A«h¸Ó¬Û¦P¼Æ¦r§Y¬°3­Ó´Á¼Æªº¥æ¶°­È¡C

¥»ÃD»Ý¨D»¡©ú:
·íTÄ榳Åã¥Ü¼Æ¦rªºÀx¦s®æ¡A¥B·í¨ä¦bRÄ檺¹ïÀ³´Á¼Æ(§Y.Range("R" & b.Row))¤Î¸ÓRÄ檺¹ïÀ³´Á¼Æ-T$3(§Y.Range("R" & b.Row)-T$3)¤Î¸ÓRÄ檺¹ïÀ³´Á¼Æ-T$3*2(§Y.Range("R" & b.Row)-T$3*2)~
µ¥3­Ó´Á¼Æ¦³¤@­Ó(§t)¥H¤Wªº¥æ¶°­È®É¡A«h¥æ¶°­ÈªºÀx¦s®æ¼Ð¥Ü4,45,8©³¦â¡C
EX¡J½d¨Ò¤¤ªºT96¦³Åã¥Ü¼Æ¦r¡A¥B¨ä¹ïÀ³RÄ檺´Á¼Æ(90)¤Î¸ÓRÄ檺¹ïÀ³´Á¼Æ-T$3(90-9=81)¤Î¸ÓRÄ檺¹ïÀ³´Á¼Æ-T$3*2(90-9*2=72)~
µ¥3­Ó´Á¼Æ¦³¤@­Ó(§t)¥H¤Wªº¥æ¶°­È(07,39)®É¡A«hJ96,P96¼Ð¥Ü4¸¹©³¦â¡FK87,M87¼Ð¥Ü45¸¹©³¦â¡FJ78,K78¼Ð¥Ü8¸¹©³¦â¡C

¥H¤W ÂԨѰѦÒ!ÁÂÁ±z!

TEST_2-G.rar (62.14 KB)

TOP

¦^´_ 26# ­ã´£³¡ªL
­ã¤j:±z¦n!
¤£¦n·N«ä¡A®¤¤p§Ì°õµÛ¡AÁÙ¬O§Æ±æ±z¯à½ç±Ð¦p11#ªº¼gªk~
¦]¬°11#ªº¶Q»yªk¡A¦PÄæ»P¤£­­¦PÄ檺°Ï¤À~¥u­n¦h¥[¤@¦Cµ{¦¡½X~
f y > 1 Then If R(y).Column <> R(y-1).Column Then U = 1: Exit For
«D±`²±¶«K§Q¡C

Àµ½Ð±z¼·¤¾´f¤©½ç±Ð¬°Ã«~·P®¦¡@

¤p§Ì¥H¶Qµ{¦¡¨Ì¼Ëµe¸¬Äª~¹Á¸Õ°µ­Ó½d¨Ò:
TEST_2-­ã.rar (63.13 KB)
ÂԨѰѦÒ!ÁÂÁ±z!

TOP

        ÀR«ä¦Û¦b : ¹ï¤÷¥À­nª¾®¦¡A·P®¦¡B³ø®¦¡C
ªð¦^¦Cªí ¤W¤@¥DÃD