寬表格需水平捲動查看完整記錄,極易「看走眼」誤讀上下列資料。
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.EntireRow.Interior.ColorIndex = 10 Then
Target.EntireRow.Interior.ColorIndex = 0
Else
Target.EntireRow.Interior.ColorIndex = 10
End If
End Sub
10 為其他 ColorIndex(如 6=黃、37=淺藍)。利用 Worksheet_SelectionChange 事件,切換 EntireRow.Interior.ColorIndex 在 10(綠)與 0(無填滿)間切換。