关于选择某个单元格后,指定的单元格区域自动变色
发布网友
发布时间:2022-04-25 21:53
我来回答
共3个回答
热心网友
时间:2022-04-25 23:22
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
On Error Resume Next
Cells.FormatConditions.Delete
With Target.EntireRow.FormatConditions
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = 7
End With
End Sub
你用这段代码吧
热心网友
时间:2022-04-26 00:40
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
If Target.Column >= 2 And Target.Column <= 16 Then
Cells.FormatConditions.Delete
With Target.FormatConditions
.Delete
.Add xlExpression, , "TRUE"
.Item(1).Interior.ColorIndex = 33
End With
Else
End
End If
End Sub来自:求助得到的回答