楼上那个代码,多选单元格的时候会把整片区域都变色,加个IF判断就能解决。右键点击工作表标签 → 查看代码,在代码框里复制粘贴下面这段:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count = 1 Then
Cells.Font.ColorIndex = 2
Target.Font.ColorIndex = 0
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count = 1 Then
Cells.Font.ColorIndex = 2
Target.Font.ColorIndex = 0
End If
End Sub