excel同列不同颜色数据条

excel

1个回答

写回答

柔弱的月饼

2025-12-17 17:17

+ 关注

etc
etc

'添加sheetchange事件代码,单元格数值变动时自动刷新

Private Sub Workbook_Sheetchange(ByVal Sh As Object, ByVal Target As Range)

If Target.Column = 3 Then '假如数据在C列

Target.Select

If Target.Value = 0.5 Then ' With Cells(Target.Row, Target.Column).Interior With Target.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 255 '红色 .TintAndShade = 0 .PatternTintAndShade = 0 End WithElse With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorAccent1 '蓝色 .TintAndShade = 0 .PatternTintAndShade = 0 End WithEnd IfEnd IfEnd Sub

举报有用(0分享收藏

Copyright © 2025 IZhiDa.com All Rights Reserved.

知答 版权所有 粤ICP备2023042255号