Excel_VBA 常用代码

匿名 (未验证) 提交于 2019-12-02 23:43:01

单元格编辑后改变背景色(6号,355832828)

 1 Dim oldvalue As Variant  2   3 Private Sub Worksheet_Change(ByVal Target As Range)  4     On Error Resume Next  5     If oldvalue <> Target.Value Then  6         With Target.Cells.FormatConditions  7             .Delete  8             .Add xlExpression, , "TRUE"  9             .Item(1).Interior.ColorIndex = 9 10         End With 11     End If 12 End Sub 13  14 Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) 15     oldvalue = Target.Value 16 End Sub

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!