Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If CheckBox1.Caption = "開" Then Call Spotlight(Target)
End Sub
Sub Spotlight(ByVal Target As Excel.Range)
On Error Resume Next
Cells.FormatConditions.Delete
With Target.EntireColumn
.FormatConditions.Add xlExpression, , "=true"
.FormatConditions(1).Interior.ColorIndex = 20
End With
With Target.EntireRow
.FormatConditions.Add xlExpression, , "=true"
.FormatConditions(2).Interior.ColorIndex = 20
End With
End Sub
複製代碼
怎樣解決關掉之後可以刪除聚光燈作者: 准提部林 時間: 2020-5-13 14:15
Private Sub CheckBox1_Click()
If CheckBox1.Value = False Then
CheckBox1.Caption = "關"
'ActiveSheet.Cells.Interior.ColorIndex = xlNone
Cells.FormatConditions.Delete
Else: CheckBox1.Caption = "開"
End If
End Sub作者: 准提部林 時間: 2020-5-13 14:23
Sub Spotlight(ByVal Target As Excel.Range)
Cells.FormatConditions.Delete
With Union(Target.EntireColumn, Target.EntireRow)
.FormatConditions.Add xlExpression, , "=true"
.FormatConditions(1).Interior.ColorIndex = 20
End With
End Sub作者: coke373 時間: 2020-5-13 14:38