|
[img][/img]将选中单元格所在行用特殊图案突出显示
不改变原有的条件格式、填充颜色,复制、粘帖可用
说明:代码参考了fanjy的“[分享]自动为当前单元格所在行和列加上颜色 自动为当前单元格所在行和列加上颜色”
在此感谢fanjy!
在工作表中加入以下代码即可
Option Explicit
Private Sub Worksheet_Change(ByVal target As Range)
If Application.CutCopyMode <> False Then
Application.CutCopyMode = False
' If Cells(1, 1) = 1 Then '可定义工作表的第1格为控制突出显示开关,1为突出显示,其它为正常显示
Cells.EntireRow.Interior.PatternColorIndex = 2
Cells.EntireRow.Interior.Pattern = 1
target.EntireRow.Interior.PatternColorIndex = 46
target.EntireRow.Interior.Pattern = 17
' End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal target As Range)
If Application.CutCopyMode = False Then
' If Cells(1, 1) = 1 Then
Cells.EntireRow.Interior.PatternColorIndex = 2
Cells.EntireRow.Interior.Pattern = 1
target.EntireRow.Interior.PatternColorIndex = 46
target.EntireRow.Interior.Pattern = 17
' End If
Else
Exit Sub
End If
End Sub
|
-
示例
|