- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 15
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-12
|
¥»©«³Ì«á¥Ñ 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®æ¦¡ªº³¡¤À:- Sub SetRng()
- Dim vColor()
- Dim lCol&(), lCols&, lRow&(), lRows&, lL1&, lL2&, lL3&, ll4&
- vColor = Array(0, 38, 4, 8)
- lL1 = 2 ' ¨ú±o¤¦æ©Ò¦bÄ渹
- lCols = Cells(lL1, Columns.Count).End(xlToLeft).Column ' ¸ê®Æ¥½Äæ
- ReDim lCol(0) ' °}¦Cªì©l¤Æ
- Do While lL1 <= lCols
- ReDim Preserve lCol(UBound(lCol) + 1)
- lCol(UBound(lCol)) = lL1
- lL1 = Cells(1, lL1).End(xlToRight).Column ' §ä¤UÓ¦³¸ê®ÆªºÄæ
- Loop
-
- lL1 = 3 ' ¨ú±o¤pp»PÁ`p©Ò¦b¦C¸¹
- ReDim lRow(0) ' °}¦Cªì©l¤Æ
- Do While Cells(lL1, 1) <> "Á`p"
- Do While Cells(lL1, 1) <> "¤pp" And Cells(lL1, 1) <> "Á`p"
- lL1 = lL1 + 1
- Loop
- If Cells(lL1, 1) <> "Á`p" Then ' ¤pp©Ò¦b¦C¸¹
- ReDim Preserve lRow(UBound(lRow) + 1)
- lRow(UBound(lRow)) = lL1
- lL1 = lL1 + 1
- Else
- lRows = lL1 ' Á`p©Ò¦b¦C¸¹
- End If
- Loop
-
- ' ----- ²M°£®æ¦¡³]©w»P®Ø½u -----
- With Range(Cells(3, 2), Cells(lRows, lCols)) ' ¸ê®Æ½d³ò
- .FormatConditions.Delete ' ²M°£©Ò¦³®æ¦¡³W«h
- For lL1 = 1 To 10 ' ²M°£®Ø½u³]©w
- .Borders(lL1).LineStyle = 0
- Next
- .Interior.Pattern = xlNone ' ²M°£©³¦â
- End With
-
- For lL1 = 2 To UBound(lCol) Step 2 ' ³]©w°¸¼Æ¬q¸¨
- With Range(Cells(3, lCol(lL1)), Cells(lRows, lCol(lL1 + 1) - 1))
- .Interior.ColorIndex = 34 ' ³]©w©³¦â
- For lL2 = 7 To 10 ' ³]©w¥~®Ø½u
- With .Borders(lL2)
- .LineStyle = 1
- .ColorIndex = 5
- .Weight = 4
- End With
- Next
- End With
- Next
-
- On Error Resume Next ' µo¥Í¿ù»~¸õ¨ì¤U¤@¦æ«ü¥O,¨Ò¦p¶W¹L°}¦C¯Á¤Þ(³Ì«á¤@¦¸®É),¦CӼƤp©ó¦æÓ¼Æ
- For lL1 = 1 To UBound(lCol) ' ³]©w¹ï¨¤°Ï°ì©³¦â
- Range(Cells(lRow(lL1), lCol(lL1)), Cells(lRow(lL1), lCol(lL1 + 1) - 1)) _
- .Interior.ColorIndex = 36
- Next
- lL1 = lL1 - 1
- Range(Cells(lRow(lL1), lCol(lL1)), Cells(lRow(lL1), lCols)).Interior.ColorIndex = 36
- On Error GoTo 0 ' µo¥Í¿ù»~¤¤Â_µ{¦¡¨ÃÅã¥Ü¿ù»~°T®§
-
- ReDim Preserve lCol(UBound(lCol) + 1) ' ÁY´îµ{¦¡½X,³o¸Ì°µÓ¨ú¥©°Ê§@,°t¦X°j°é§@·~
- lCol(UBound(lCol)) = lCols
-
- ll4 = UBound(lCol) - 1 ' ´î¤Öpºâ¦¸¼Æ
- For lL1 = 1 To ll4 ' ¤pp¦C³]©w®æ¦¡¤Æ¤½¦¡
- For lL2 = 1 To UBound(lRow)
- 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 & ")"
- .FormatConditions(.FormatConditions.Count).SetFirstPriority
- With .FormatConditions(1).Interior
- .PatternColorIndex = xlAutomatic
- .ColorIndex = vColor(lL3)
- .TintAndShade = 0
- End With
- .FormatConditions(1).StopIfTrue = True
- End With
- Next
- Next
- Next
-
- For lL1 = 1 To ll4 ' Á`p¦C³]©w®æ¦¡¤Æ¤½¦¡
- If lL1 = ll4 Then
- lL1 = lL1
- End If
- For lL3 = 1 To 3
- With Range(Cells(lRows, lCol(lL1)), Cells(lRows, _
- IIf(lL1 = ll4, lCols, lCol(lL1 + 1) - 1)))
- .FormatConditions.Add Type:=xlExpression, Formula1:= _
- "=" & Cells(lRows, lCol(lL1)).Address(0, 0) & _
- "=LARGE(" & .Offset(0).Address & "," & lL3 & ")"
- .FormatConditions(.FormatConditions.Count).SetFirstPriority
- With .FormatConditions(1).Interior
- .PatternColorIndex = xlAutomatic
- .ColorIndex = vColor(lL3)
- .TintAndShade = 0
- End With
- .FormatConditions(1).StopIfTrue = True
- End With
- Next
- Next
- End Sub
½Æ»s¥N½X
®æ¦¡¤Æªº»yªk-a2.zip (74.96 KB)
|
|