|
发表于 2016-6-14 21:59
|
显示全部楼层
本楼为最佳答案
song_syl灰太狼 发表于 2016-6-14 21:55
在这里再次感谢您,不厌其烦的帮我不断的改进这个代码!谢谢!谢谢了!
还有2个问题,我也是 ...
疏忽了,没想周全!- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim str$
- If Target.Count > 1 Then Exit Sub
- Target.Font.ColorIndex = 1 '先还原成黑色
- 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
复制代码 |
|