我似乎无法让它正常工作
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim LastRow As Long
If Not Intersect(Target, Range("C7,D7,E7,F7,G7,C8,D8,E8,F8,G8,C9,D9,E9,F9,G9,C10,D10,E10,F10,G10,C11,D11,E11,F11,G11")) Is Nothing Then
Application.EnableEvents = False
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
Application.EnableEvents = True
End With
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.249977111117893
End With
End If
End Sub
答案 0 :(得分:2)
您的代码确实有用(或者至少告诉我们什么没有)。
请务必将此代码放在工作表模块中:
[编辑]您应该重新激活代码末尾的事件:
Application.EnableEvents = True