|
代码替换成下面这个,可以设置N个- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim str$
- str = "卖品" '要上色的字符串
- If InStr(Target.Value, str) Then Target.Characters(Start:=InStr(Target.Value, str), Length:=Len(str)).Font.ColorIndex = 3 '这个3是设置颜色的
- str = "赠品" '要上色的字符串
- If InStr(Target.Value, str) Then Target.Characters(Start:=InStr(Target.Value, str), Length:=Len(str)).Font.ColorIndex = 5 '这个5是设置颜色的
- str = "退货" '要上色的字符串
- If InStr(Target.Value, str) Then Target.Characters(Start:=InStr(Target.Value, str), Length:=Len(str)).Font.ColorIndex = 8 '这个8是设置颜色的
- str = "其他原因退回" '要上色的字符串
- If InStr(Target.Value, str) Then Target.Characters(Start:=InStr(Target.Value, str), Length:=Len(str)).Font.ColorIndex = 13 '这个13是设置颜色的
- End Sub
复制代码 |
|