|
即使用工作表事件还是可以保留复制剪贴的功能,如下代码- Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal target As Range)
- If Application.CutCopyMode <> False Then
- Application.CutCopyMode = False
- Call ColorBand(target)
- End If
- End Sub
- Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal target As Range)
- If Application.CutCopyMode = False Then
- Call ColorBand(target)
- Else
- Exit Sub
- End If
- End Sub
- Private Sub ColorBand(ByVal rngTarget As Range)
- On Error Resume Next
- [ChangeColor].FormatConditions.Delete
- rngTarget.EntireRow.Name = "ChangeColor"
- With [ChangeColor].FormatConditions
- .Delete
- .Add xlExpression, , "TRUE"
- .Item(1).Interior.ColorIndex = 17
- End With
- End Sub
复制代码 只是,如果是用条件格式方式,将会删除原有的所有条件格式
对用户来是不是最好的选择。 |
|