- ©«¤l
- 8
- ¥DÃD
- 4
- ºëµØ
- 0
- ¿n¤À
- 62
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN10
- ³nÅ骩¥»
- OFFICE2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2016-12-8
- ³Ì«áµn¿ý
- 2025-9-9
|
§ä¨ìµª®×¤F¡AÁÂÁ¦U¦ìÀ°¦£
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet
Dim cell As Range
Dim lowerLimit1 As Double, upperLimit1 As Double
Dim lowerLimit2 As Double, upperLimit2 As Double
Dim lowerLimit3 As Double, upperLimit3 As Double
Dim lowerLimit4 As Double, upperLimit4 As Double
' ³]©w·í«e¤u§@ªí
Set ws = ThisWorkbook.ActiveSheet
' Ū¨ú±ø¥ó½d³òªºÈ
lowerLimit1 = ws.Range("T14").Value
upperLimit1 = ws.Range("U14").Value
lowerLimit2 = ws.Range("T15").Value
upperLimit2 = ws.Range("U15").Value
lowerLimit3 = ws.Range("T19").Value
upperLimit3 = ws.Range("U19").Value
lowerLimit4 = ws.Range("T20").Value
upperLimit4 = ws.Range("U20").Value
' Àˬd½d³ò
For Each cell In ws.Range("K14:R14")
If IsNumeric(cell.Value) Then
If cell.Value < lowerLimit1 Or cell.Value > upperLimit1 Then
cell.Font.Color = RGB(255, 0, 0) ' ³]¬°¬õ¦â
Else
cell.Font.Color = RGB(0, 0, 0) ' «ì´_¬°¶Â¦â
End If
End If
Next cell
' Àˬd½d³ò
For Each cell In ws.Range("K15:R18")
If IsNumeric(cell.Value) Then
If cell.Value < lowerLimit2 Or cell.Value > upperLimit2 Then
cell.Font.Color = RGB(255, 0, 0) ' ³]¬°¬õ¦â
Else
cell.Font.Color = RGB(0, 0, 0) ' «ì´_¬°¶Â¦â
End If
End If
Next cell
' Àˬd½d³ò
For Each cell In ws.Range("K19:R19")
If IsNumeric(cell.Value) Then
If cell.Value > upperLimit3 Then
cell.Font.Color = RGB(255, 0, 0) ' ³]¬°¬õ¦â
Else
cell.Font.Color = RGB(0, 0, 0) ' «ì´_¬°¶Â¦â
End If
End If
Next cell
' Àˬd½d³ò
For Each cell In ws.Range("K20:R22")
If IsNumeric(cell.Value) Then
If cell.Value < lowerLimit4 Or cell.Value > upperLimit4 Then
cell.Font.Color = RGB(255, 0, 0) ' ³]¬°¬õ¦â
Else
cell.Font.Color = RGB(0, 0, 0) ' «ì´_¬°¶Â¦â
End If
End If
Next cell
End Sub |
|