Private Sub Worksheet_Change(ByVal Target As Range)
Dim xA As Range, xR As Range
Set xA = Intersect(Target, Range("U:U"))
If xA Is Nothing Then Exit Sub
Application.ScreenUpdating = False
For Each xR In xA
Range(Cells(xR.Row, 1), Cells(xR.Row, 22)).Font.ColorIndex = 15 ^ -(xR > 1)
Next
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xA As Range, xR As Range
Set xA = Intersect(Target, Range("O:O"))
If xA Is Nothing Then Exit Sub
Application.ScreenUpdating = False
For Each xR In xA
Range(Cells(xR.Row, 16), xR).Font.ColorIndex = 2 ^ -(xR = "")
Next
End Sub
這兩程序有交互影響結果:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xA As Range, xR As Range
Application.ScreenUpdating = False
Set xA = Intersect(Target, Range("U:U"))
If xA Is Nothing Then GoTo xA0
For Each xR In xA
Range(Cells(xR.Row, 1), Cells(xR.Row, 22)).Font.ColorIndex = 15 ^ -(xR > 1)
Next
xA0:
Set xA = Intersect(Target, Range("O:O"))
If xA Is Nothing Then Exit Sub
For Each xR In xA
Range(Cells(xR.Row, 16), xR).Font.ColorIndex = 2 ^ -(xR = "")
Next
End Sub作者: wayne0303 時間: 2023-10-23 15:05