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

[µo°Ý] ¤£©w°Ï°ì¬q¸¨ªº®æ¦¡¤Æ»yªk¡C

Àµ½Ð¦U¦ì¤j¤jÀ°¦£½s¼g1­Ó¯à¨Ì"¤p­p"©M"Á`­p"ªº¼ÐÃD¦Û°Ê§P§O¬q¸¨°Ï°ì½d³ò§@®æ¦¡³]©wªºµ{¦¡ÀÉ¡A
¥H§Q¯à¥H1´Ú ...
ziv976688 µoªí©ó 2020-12-25 07:31

´£¨Ñ¥t¥~¤@­Ó¨¤«×ªº¼gªk :
  1. Sub SetRng()
  2.   Dim vColor()
  3.   Dim lCol&(), lCols&, lRow&(), lRows&, lL1&, lL2&, lL3&
  4.   
  5.   ReDim lCol(5) ' ¤­¦æ¥u¦³5­Ó
  6.   vColor = Array(0, 38, 4, 8)
  7.   ' ----- ¨ú±o©Ò¦³ÃöÁäÄ渹»P¦C¸¹ -----
  8.   lCol(1) = 2 ' ¨ú±o¤­¦æ¤å¦r©Ò¦bÄ渹
  9.   For lL1 = 2 To 5
  10.     lCol(lL1) = Cells(1, lCol(lL1 - 1) + 1).End(xlToRight).Column
  11.   Next
  12.   lCols = Cells(2, Columns.Count).End(xlToLeft).Column ' ¦b²Ä2¦C§ä¸ê®Æ¥½Äæ
  13.   
  14.   lL1 = 3 ' ¨ú±o¤p­p»PÁ`­p©Ò¦b¦C¸¹
  15.   ReDim lRow(0) ' °}¦Cªì©l¤Æ
  16.   Do While Cells(lL1, 1) <> "Á`­p"
  17.     Do While Cells(lL1, 1) <> "¤p­p" And Cells(lL1, 1) <> "Á`­p"
  18.       lL1 = lL1 + 1
  19.     Loop
  20.     If Cells(lL1, 1) <> "Á`­p" Then ' ¤p­p©Ò¦b¦C¸¹
  21.       ReDim Preserve lRow(UBound(lRow) + 1)
  22.       lRow(UBound(lRow)) = lL1
  23.       lL1 = lL1 + 1
  24.     Else
  25.       lRows = lL1 ' Á`­p©Ò¦b¦C¸¹
  26.     End If
  27.   Loop
  28.   
  29.   ' ----- ²M°£®æ¦¡³]©w»P®Ø½u -----
  30.   With Range(Cells(3, 2), Cells(lRows, lCols)) ' ¸ê®Æ½d³ò
  31.     .FormatConditions.Delete ' ²M°£©Ò¦³®æ¦¡³W«h
  32.     For lL1 = 1 To 10 ' ²M°£®Ø½u³]©w
  33.       .Borders(lL1).LineStyle = 0
  34.     Next
  35.     .Interior.Pattern = xlNone ' ²M°£©³¦â
  36.   End With

  37.     ' ----- ¶}©l®æ¦¡³]©w -----
  38.   For lL1 = 2 To UBound(lCol) Step 2 ' ³]©w°¸¼Æ¬q¸¨
  39.     With Range(Cells(3, lCol(lL1)), Cells(lRows, lCol(lL1 + 1) - 1))
  40.       .Interior.ColorIndex = 34 ' ³]©w©³¦â
  41.       For lL2 = 7 To 10 ' ³]©w¥~®Ø½u
  42.         With .Borders(lL2)
  43.           .LineStyle = 1
  44.           .ColorIndex = 5
  45.           .Weight = 4
  46.         End With
  47.       Next
  48.     End With
  49.   Next
  50.   
  51.   For lL1 = 1 To 4 ' ³]©w¹ï¨¤°Ï°ì©³¦â
  52.     Range(Cells(lRow(lL1), lCol(lL1)), Cells(lRow(lL1), lCol(lL1 + 1) - 1)) _
  53.          .Interior.ColorIndex = 36
  54.   Next
  55.   Range(Cells(lRow(5), lCol(5)), Cells(lRow(5), lCols)).Interior.ColorIndex = 36
  56.   
  57.   ReDim Preserve lCol(UBound(lCol) + 1) ' ÁY´îµ{¦¡½X,³o¸Ì°µ­Ó¨ú¥©°Ê§@,°t¦X°j°é§@·~
  58.   lCol(UBound(lCol)) = lCols
  59.   
  60.   For lL1 = 1 To 5 ' ³]©w®æ¦¡¤Æ¤½¦¡
  61.     For lL2 = 1 To UBound(lRow)
  62.       For lL3 = 1 To 3
  63.         With Range(Cells(lRow(lL2), lCol(lL1)), Cells(lRow(lL2), lCol(lL1 + 1) - 1))
  64.           .FormatConditions.Add Type:=xlExpression, Formula1:= _
  65.           "=" & Cells(lRow(lL2), lCol(lL1)).Address(0, 0) & "=LARGE(" & .Offset(0).Address & "," & lL3 & ")"
  66.           .FormatConditions(.FormatConditions.Count).SetFirstPriority
  67.           With .FormatConditions(1).Interior
  68.             .PatternColorIndex = xlAutomatic
  69.             .ColorIndex = vColor(lL3)
  70.             .TintAndShade = 0
  71.           End With
  72.           .FormatConditions(1).StopIfTrue = True
  73.         End With
  74.       Next
  75.     Next
  76.   Next
  77. End Sub
½Æ»s¥N½X
®æ¦¡¤Æªº»yªk-a.zip (29.78 KB)

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2020-12-27 15:56 ½s¿è
¦^´_  luhpro
I ¤j : ±z¦n !
·PÁ±zªºÀ°¦£©M«ü¾É
´ú¸Õµ²ªG³ø§i :
¤j­ì«h"¦Û°Ê¤À¬q"¬OOKªº¡F ...
ziv976688 µoªí©ó 2020-12-26 16:26

±à...
Excel 2003 ·|¦³¿ù»~°Ú,
§Ú¦³³¡¤À«ü¥O¬O³z¹LExcel 2019 ¿ý»s¥¨¶°¥Í¦A°µ­×§ïªº.
³o¸Ì¥ý´£¨Ñ­×§ï«á¤ä´©¦h­Ó¤­¦æ¸ê®ÆªºÀÉ®×, (¦]¬°¤£²M·¡§Aªº¸ê®Æ¬O¦p¦óÂX®iªº, ½d¨ÒÀÉ´Nª½±µ§â­ìªí®æ¥ª¥k¤W¤U«þ¶K¼W¥[¤F)
·íµM,À³¸ÓÁÙ¬O·|µo¥Í­ì¥ý¦³ªº¿ù»~,
¥i¤ä´©2003ª©ªºÀÉ®×·|±ß¤@ÂI,
Office¤£¯à¦P®É¸Ë¨â®Mª©¥»,
»Ý­n§ï¥hÂÂPC´ú¤@¤U.

¥t¥~,­×§ï¤F¤@¨Ç¤pBUG,
ÁÙ¦³,¦]¬°¤§«e§â®榡¥þ³¡§R±¼¤F(¥]§tÁ`­p),
©Ò¥H¦A¼W¥[³]©wÁ`­p¦C®æ¦¡ªº³¡¤À:
  1. Sub SetRng()
  2.   Dim vColor()
  3.   Dim lCol&(), lCols&, lRow&(), lRows&, lL1&, lL2&, lL3&, ll4&

  4.   vColor = Array(0, 38, 4, 8)
  5.   lL1 = 2 ' ¨ú±o¤­¦æ©Ò¦bÄ渹
  6.   lCols = Cells(lL1, Columns.Count).End(xlToLeft).Column ' ¸ê®Æ¥½Äæ
  7.   ReDim lCol(0) ' °}¦Cªì©l¤Æ
  8.   Do While lL1 <= lCols
  9.     ReDim Preserve lCol(UBound(lCol) + 1)
  10.     lCol(UBound(lCol)) = lL1
  11.     lL1 = Cells(1, lL1).End(xlToRight).Column  ' §ä¤U­Ó¦³¸ê®ÆªºÄæ
  12.   Loop
  13.   
  14.   lL1 = 3 ' ¨ú±o¤p­p»PÁ`­p©Ò¦b¦C¸¹
  15.   ReDim lRow(0) ' °}¦Cªì©l¤Æ
  16.   Do While Cells(lL1, 1) <> "Á`­p"
  17.     Do While Cells(lL1, 1) <> "¤p­p" And Cells(lL1, 1) <> "Á`­p"
  18.       lL1 = lL1 + 1
  19.     Loop
  20.     If Cells(lL1, 1) <> "Á`­p" Then ' ¤p­p©Ò¦b¦C¸¹
  21.       ReDim Preserve lRow(UBound(lRow) + 1)
  22.       lRow(UBound(lRow)) = lL1
  23.       lL1 = lL1 + 1
  24.     Else
  25.       lRows = lL1 ' Á`­p©Ò¦b¦C¸¹
  26.     End If
  27.   Loop
  28.   
  29.   ' ----- ²M°£®æ¦¡³]©w»P®Ø½u -----
  30.   With Range(Cells(3, 2), Cells(lRows, lCols)) ' ¸ê®Æ½d³ò
  31.     .FormatConditions.Delete ' ²M°£©Ò¦³®æ¦¡³W«h
  32.     For lL1 = 1 To 10 ' ²M°£®Ø½u³]©w
  33.       .Borders(lL1).LineStyle = 0
  34.     Next
  35.     .Interior.Pattern = xlNone ' ²M°£©³¦â
  36.   End With
  37.   
  38.   For lL1 = 2 To UBound(lCol) Step 2 ' ³]©w°¸¼Æ¬q¸¨
  39.     With Range(Cells(3, lCol(lL1)), Cells(lRows, lCol(lL1 + 1) - 1))
  40.       .Interior.ColorIndex = 34 ' ³]©w©³¦â
  41.       For lL2 = 7 To 10 ' ³]©w¥~®Ø½u
  42.         With .Borders(lL2)
  43.           .LineStyle = 1
  44.           .ColorIndex = 5
  45.           .Weight = 4
  46.         End With
  47.       Next
  48.     End With
  49.   Next
  50.   
  51. On Error Resume Next ' µo¥Í¿ù»~¸õ¨ì¤U¤@¦æ«ü¥O,¨Ò¦p¶W¹L°}¦C¯Á¤Þ(³Ì«á¤@¦¸®É),¦C­Ó¼Æ¤p©ó¦æ­Ó¼Æ
  52.   For lL1 = 1 To UBound(lCol) ' ³]©w¹ï¨¤°Ï°ì©³¦â
  53.     Range(Cells(lRow(lL1), lCol(lL1)), Cells(lRow(lL1), lCol(lL1 + 1) - 1)) _
  54.         .Interior.ColorIndex = 36
  55.   Next
  56.   lL1 = lL1 - 1
  57.   Range(Cells(lRow(lL1), lCol(lL1)), Cells(lRow(lL1), lCols)).Interior.ColorIndex = 36
  58. On Error GoTo 0 ' µo¥Í¿ù»~¤¤Â_µ{¦¡¨ÃÅã¥Ü¿ù»~°T®§
  59.   
  60.   ReDim Preserve lCol(UBound(lCol) + 1) ' ÁY´îµ{¦¡½X,³o¸Ì°µ­Ó¨ú¥©°Ê§@,°t¦X°j°é§@·~
  61.   lCol(UBound(lCol)) = lCols
  62.   
  63.   ll4 = UBound(lCol) - 1 ' ´î¤Ö­pºâ¦¸¼Æ
  64.   For lL1 = 1 To ll4 ' ¤p­p¦C³]©w®æ¦¡¤Æ¤½¦¡
  65.     For lL2 = 1 To UBound(lRow)
  66.       For lL3 = 1 To 3
  67.         With Range(Cells(lRow(lL2), lCol(lL1)), Cells(lRow(lL2), _
  68.                      IIf(lL1 = ll4, lCols, lCol(lL1 + 1) - 1)))
  69.           .FormatConditions.Add Type:=xlExpression, Formula1:= _
  70.               "=" & Cells(lRow(lL2), lCol(lL1)).Address(0, 0) & _
  71.               "=LARGE(" & .Offset(0).Address & "," & lL3 & ")"
  72.           .FormatConditions(.FormatConditions.Count).SetFirstPriority
  73.           With .FormatConditions(1).Interior
  74.             .PatternColorIndex = xlAutomatic
  75.             .ColorIndex = vColor(lL3)
  76.             .TintAndShade = 0
  77.           End With
  78.           .FormatConditions(1).StopIfTrue = True
  79.         End With
  80.       Next
  81.     Next
  82.   Next
  83.   
  84.   For lL1 = 1 To ll4 ' Á`­p¦C³]©w®æ¦¡¤Æ¤½¦¡
  85.     If lL1 = ll4 Then
  86.       lL1 = lL1
  87.     End If
  88.     For lL3 = 1 To 3
  89.       With Range(Cells(lRows, lCol(lL1)), Cells(lRows, _
  90.                    IIf(lL1 = ll4, lCols, lCol(lL1 + 1) - 1)))
  91.         .FormatConditions.Add Type:=xlExpression, Formula1:= _
  92.             "=" & Cells(lRows, lCol(lL1)).Address(0, 0) & _
  93.             "=LARGE(" & .Offset(0).Address & "," & lL3 & ")"
  94.         .FormatConditions(.FormatConditions.Count).SetFirstPriority
  95.         With .FormatConditions(1).Interior
  96.           .PatternColorIndex = xlAutomatic
  97.           .ColorIndex = vColor(lL3)
  98.           .TintAndShade = 0
  99.         End With
  100.         .FormatConditions(1).StopIfTrue = True
  101.       End With
  102.     Next
  103.   Next
  104. End Sub
½Æ»s¥N½X
®æ¦¡¤Æªº»yªk-a2.zip (74.96 KB)

TOP

¦^´_  luhpro
I ¤j : ±z¦n !
·PÁ±zªºÀ°¦£©M«ü¾É
´ú¸Õµ²ªG³ø§i :
¤j­ì«h"¦Û°Ê¤À¬q"¬OOKªº¡F ...
ziv976688 µoªí©ó 2020-12-26 16:26

¶W¹L30¤ÀÄÁ.
­è­èµo²{·íªì¬°¤F¦w¸ËOffice2019¦³§âÂÂPCªºOffice²¾°£¤F, (§óÁV¿|ªº¬OWin7ÁÙ¤£¯à¦w¸ËOffice2109)
²{¦bÁ{®É§ä¤£¨ì·íªì¶Rªº¥]¸Ë§Ç¸¹. O.O
©Ò¥H¥u¯à¥ý¥H n7822123¤j¤j ´£¨Ñªºµ{¦¡¤ù¬q¨Ó­×§ï :
      For lL3 = 1 To 3
        With Range(Cells(lRow(lL2), lCol(lL1)), Cells(lRow(lL2), _
                     IIf(lL1 = ll4, lCols, lCol(lL1 + 1) - 1)))
          .FormatConditions.Add Type:=xlExpression, Formula1:= _
              "=" & Cells(lRow(lL2), lCol(lL1)).Address(0, 0) & _
              "=LARGE(" & .Offset(0).Address & "," & lL3 & ")".Interior.ColorIndex = vColor(lL3) ' <--- ¥[³o¬q
          '.FormatConditions(.FormatConditions.Count).SetFirstPriority ' ©³¤U³£§R±¼
          'With .FormatConditions(1).Interior
          '  .PatternColorIndex = xlAutomatic
          '  .ColorIndex = vColor(lL3)
          '  .TintAndShade = 0
          'End With
          '.FormatConditions(1).StopIfTrue = True

        End With
      Next
¨SÀô¹Ò¤£¯àÅçÃÒ,
¥u¦n½Ð§A¦Û¤v¸Õ¸Õ¬Ý¤F......

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2020-12-27 22:07 ½s¿è
¦^´_  luhpro
luhpro¤j¤j : ±z¦n !
°£¤F«e3¤j¼Ð¥Ü©³¦â¦]¦³»P2003ª©½Ä¬ð¤§¥~¡A¨ä¾l´ú¸Õ³£OK¤F
...
ziv976688 µoªí©ó 2020-12-27 19:48

©êºp,¨S¹ê´úªGµMÁÙ¬O·|¥X¿ù, 12#ªºµ{¦¡¦³°ÝÃD, ¤§«eªºµ{¦¡¦b2003­n­×§ï¤@¤U:
          .FormatConditions.Add Type:=xlExpression, Formula1:= _
              "=" & Cells(lRow(lL2), lCol(lL1)).Address(0, 0) & _
              "=LARGE(" & .Offset(0).Address & "," & lL3 & ")"
          .FormatConditions(lL3)
.Interior.ColorIndex = vColor(lL3) ' <--- ¥[³o­Ó

¥t,¸g´ú¸Õ, ³]©w®æ¦¡®É­n¥ý Select ¦n§@¥Î°Ï¶ô, §_«h¤½¦¡·|¬O¿ù»~ªº.
¦A¥[¤W®æ¦¡³]©w¤¤µe­±·|¶Ã¸õ,
©Ò¥H§Ú¤]¥[¤F ScreenUpdating ±±¨î,
­×§ï«áµ{¦¡¦p¤U:
  1. Application.ScreenUpdating = False
  2.   ll4 = UBound(lCol) - 1 ' ´î¤Ö­pºâ¦¸¼Æ
  3.   For lL1 = 1 To ll4 ' ¤p­p¦C³]©w®æ¦¡¤Æ¤½¦¡
  4.     For lL2 = 1 To UBound(lRow)
  5.       For lL3 = 1 To 3
  6.         With Range(Cells(lRow(lL2), lCol(lL1)), Cells(lRow(lL2), _
  7.                      IIf(lL1 = ll4, lCols, lCol(lL1 + 1) - 1)))
  8.           .Select
  9.           .FormatConditions.Add Type:=xlExpression, Formula1:= _
  10.               "=" & Cells(lRow(lL2), lCol(lL1)).Address(0, 0) & _
  11.               "=LARGE(" & .Offset(0).Address & "," & lL3 & ")"
  12.           .FormatConditions(lL3).Interior.ColorIndex = vColor(lL3)
  13.           'With .FormatConditions(1).Interior
  14.           '  .PatternColorIndex = xlAutomatic
  15.           '  .ColorIndex = vColor(lL3)
  16.           '  .TintAndShade = 0
  17.           'End With
  18.           '.FormatConditions(1).StopIfTrue = True
  19.         End With
  20.       Next
  21.     Next
  22.   Next
  23.   
  24.   For lL1 = 1 To ll4 ' Á`­p¦C³]©w®æ¦¡¤Æ¤½¦¡
  25.     If lL1 = ll4 Then
  26.       lL1 = lL1
  27.     End If
  28.     For lL3 = 1 To 3
  29.       With Range(Cells(lRows, lCol(lL1)), Cells(lRows, _
  30.                    IIf(lL1 = ll4, lCols, lCol(lL1 + 1) - 1)))
  31.         .Select
  32.         .FormatConditions.Add Type:=xlExpression, Formula1:= _
  33.             "=" & Cells(lRows, lCol(lL1)).Address(0, 0) & _
  34.             "=LARGE(" & .Offset(0).Address & "," & lL3 & ")"
  35.         .FormatConditions(lL3).Interior.ColorIndex = vColor(lL3)
  36.         'With .FormatConditions(1).Interior
  37.         '  .PatternColorIndex = xlAutomatic
  38.         '  .ColorIndex = vColor(lL3)
  39.         '  .TintAndShade = 0
  40.         'End With
  41.         '.FormatConditions(1).StopIfTrue = True
  42.       End With
  43.     Next
  44.   Next
  45. Application.ScreenUpdating = True
½Æ»s¥N½X
®æ¦¡¤Æªº»yªk-a2-2003.zip (66.38 KB)

TOP

        ÀR«ä¦Û¦b : ½_ÁJµ²±o¶V¹¡º¡¡A¶V·|©¹¤U««¡A¤@­Ó¤H¶V¦³¦¨´N¡A´N­n¶V¦³Á¾¨Rªº¯ÝÃÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD