樓上那個代碼,多選單元格的時候會把整片區域都變色,加個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
