根據描述可以使用VBA的selection change 事件來處理Excel版本參考:20101、ALT+F11,進入VBE編輯器2、雙擊Sheet1標籤,貼上如下程式碼:Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)On Error Resume NextCells.FormatConditions.DeleteWith Target.EntireRow.FormatConditions .Delete .Add xlExpression, , "TRUE" .Item(1).Interior.ColorIndex = 9End WithWith Target.EntireColumn.FormatConditions .Delete .Add xlExpression, , "TRUE" .Item(1).Interior.ColorIndex = 9End WithEnd Sub3、關閉VBE對話方塊,返回工作表4、點選單元格,檢視效果
根據描述可以使用VBA的selection change 事件來處理Excel版本參考:20101、ALT+F11,進入VBE編輯器2、雙擊Sheet1標籤,貼上如下程式碼:Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)On Error Resume NextCells.FormatConditions.DeleteWith Target.EntireRow.FormatConditions .Delete .Add xlExpression, , "TRUE" .Item(1).Interior.ColorIndex = 9End WithWith Target.EntireColumn.FormatConditions .Delete .Add xlExpression, , "TRUE" .Item(1).Interior.ColorIndex = 9End WithEnd Sub3、關閉VBE對話方塊,返回工作表4、點選單元格,檢視效果