条件formattiong应用于包含数字,文本&的范围(b1:b54(空白的。完成此操作后,我需要将单元重新彩色单元格回到默认的一个,该单元格是通过条件格式为绿色或红色的。
任何人都可以给我小脚本以删除文本的CF&范围内的空白(B1:B54(。
您可以尝试:
Option Explicit
Sub Delete_CF()
Dim rng As Range, cell As Range
With ThisWorkbook.Worksheets("Sheet1") 'Change if needed
'Set the range to loop
Set rng = .Range("B1:B54")
'Loop the range
For Each cell In rng
With cell
'Check if cell is empty or not numeric
If .Value = "" Or Not IsNumeric(.Value) Then
.FormatConditions.Delete
End If
End With
Next cell
End With
End Sub