½Ð°Ý¨ÌÀx¦s®æ¼Æȱø¥óÅã¥Ü¤å¦r¤ÎI´º¦âªº°ÝÃD
- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 1# yuch8663
¸Õ¸Õ¬Ý- Sub Color()
- '¥Ü½d¨ì²Ä¤T°Ï----------------------------------------------------------------
- Dim °Ï°ì As Range, Ar1, Ar2, Ar3, È, ©³¦â, ¦r¦â, i%
- Set °Ï°ì = ThisWorkbook.Sheets("sheet2").[b4:i15,j4:l15,m4:n15]
- '°Ï°ì¬O¦U°Ïªº¦ì¸m ½Ðקï
- Ar1 = Array(Array(800, 500, 200), Array(1600, 900, 400), Array(4000, 2500, 1000))
- 'Ar1 °}¦C ¨Ì§Ç¹ïÀ³¨ì¬O¦U°Ï¶ôªºÈ
- Ar2 = Array(Array(40, 36, 19, 24, 15, 48, 35), Array(40, 36, 19, 24, 15, 48, 35), Array(3, 22, 40, 43, 50, 10, 39))
- 'Ar2 °}¦C ¨Ì§Ç¹ïÀ³¨ì¬O¦U°Ï¶ô If ©Ò§PÂ_ªº©³¦âªº¯Á¤ÞÈ
- Ar3 = Array(Array(3, 11, 1), Array(3, 11, 1), Array(6, 3, 1))
- 'Ar3 °}¦C ¨Ì§Ç¹ïÀ³¨ì¬O¦U°Ï¶ô If ©Ò§PÂ_ªº¦rÅéÃC¦âªº¯Á¤ÞÈ
- For i = 0 To °Ï°ì.Areas.Count - 1 '¨Ì§Ç¦b °Ï°ìªº¦U°Ï¶ô
- For Each F In °Ï°ì.Areas(i + 1).Cells '¨Ì§Ç¦b °Ï¶ôªº¨C¤@Ó Cell
- È = Ar1(i): ©³¦â = Ar2(i): ¦r¦â = Ar3(i) '¨ú±o°Ï¶ô©Ò¹ïÀ³¨ìªº°}¦C
- F.Font.Bold = True
- If F > È(0) Then
- F.Interior.ColorIndex = ©³¦â(0)
- F.Font.ColorIndex = ¦r¦â(0)
- ElseIf F > È(1) And F <= È(0) Then
- F.Interior.ColorIndex = ©³¦â(1)
- F.Font.ColorIndex = ¦r¦â(0)
- ElseIf F > È(2) And F <= È(1) Then
- F.Interior.ColorIndex = ©³¦â(2)
- F.Font.ColorIndex = ¦r¦â(0)
- ElseIf F < -È(2) And F >= -È(1) Then
- F.Interior.ColorIndex = ©³¦â(3)
- F.Font.ColorIndex = ¦r¦â(1)
- ElseIf F < -È(1) And F >= -È(0) Then
- F.Interior.ColorIndex = ©³¦â(4)
- F.Font.ColorIndex = ¦r¦â(1)
- ElseIf F < -È(0) Then
- F.Interior.ColorIndex = ©³¦â(5)
- F.Font.ColorIndex = ¦r¦â(1)
- Else
- F.Interior.ColorIndex = ©³¦â(6)
- F.Font.ColorIndex = ¦r¦â(2)
- F.Font.Bold = False
- End If
- Next
- Next
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 16
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-14
|
¤Wzªº±¡§Î¥i¥H§Q¥Î Switch »P Choose ¨âÓ¨ç¼Æ¨Ó¤j´T²¤Æµ{¦¡,
¥H¤U¶È¦C¥X²Ä¤@¤p¬qªºµ{¦¡,¨ä¾l¶È»ÝÅܧó¬ÛÃö¼Æ¦r«á¦A®M¥Î¤W¥h§Y¥i.
Dim iRng%, F As Variant
With ThisWorkbook.Sheets("sheet2")
For Each F In .Range("b4:i15")
iRng = Switch(F > 800, 1, F > 500 And F <= 800, 2, F > 200 And F <= 500, 3, F >= -200 And F <= 200, 4 _
, F < -200 And F >= -500, 5, F < -500 And F >= -800, 6, F < -800, 7)
F.Interior.ColorIndex = Choose(iRng, 40, 36, 19, 35, 24, 15, 48)
F.Font.ColorIndex = Choose(iRng, 3, 3, 3, 1, 11, 11, 11)
F.Font.Bold = Choose(iRng, True, True, True, False, True, True, True)
Next
For Each F In .Range("j4:l15")
.
.
.
Next
.
.
.
End With |
|
|
|
|
|
|