我有一个工作表事件宏,当单击超链接公式时触发 - 它“突出显示”(更改单元格内部颜色)超链接目标单元格,以便最终用户更容易看到。当用户不再需要它时,如何将目标单元格更改为“未突出显示”(即将单元格内部颜色更改回白色)?即我已将荧光笔“打开”,如何将其“关闭”?下面的代码将突出显示“打开”:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim ControlPoint As String
Dim RowVar As Integer
Dim Destination As String
If InStr(1, Target.Cells(1, 1).Formula, "HYPERLINK") = 0 Then Exit Sub
ControlPoint = Target.Value
RowVar = Application.WorksheetFunction _
.Match(ControlPoint, _
Sheets("Control Point Log").Range("c1:c700"), 0)
Destination = "C" & RowVar
Sheets("Control Point Log").Range(Destination).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark2
.TintAndShade = -9.99786370433668E-02
.PatternTintAndShade = 0
End With
End Sub