
答案1
這可以使用 VBA 來實現。此程式碼在 Excel 2013 中進行了測試。
在工作表中按Alt+F11開啟 VBA 編輯器。從插入選單,插入一個模組。雙擊左側窗格中插入的模組以開啟其程式碼編輯器。
現在將以下程式碼貼到其中。
Public Sub myformat()
Dim rng As Range
Set rng = Range("Sheet1!D4:D11") 'Specify the desired SheetName!Range here
For Each cel In rng.Cells
If cel.Font.Bold = True And cel.Font.Italic = True Then
cel.Font.Italic = False
cel.Interior.ColorIndex = 44 '44 is the color index number for standard Orange in Excel
End If
Next cel
End Sub
這將建立一個名為 的 VBA 巨集myformat
。這裡需要手動指定SheetName!Range。本例中Sheet1!D4:D11
是資料範圍。儲存並退出回到工作表。
按Alt+F8進入巨集對話框並執行該myformat
巨集以獲得所需的效果。