这就是我需要的: 我有超过20,000个单元格,包含黑色和红色的相同单元格文本 我想删除包含在单元格范围A1:A20347中的所有黑色文本(保持红色)。但我的日常工作不会奏效。一点帮助将不胜感激
Sub deleteonlyblacktextincell()
Range("A1:A20347").Select
For Each Cell In Selection
If Font.ColorIndex = 1 Then
' it is here where a want to delet only black text maintening other color text in the same cell
End If
Next
End Sub
答案 0 :(得分:2)
您可以选择字符颜色并单独测试它们:
Sub deleteonlyblacktextincell()
Range("A1:B20347").Select
For Each cell In Selection
Dim textOut As String
textOut = ""
For i = 1 To Len(cell)
If cell.Characters(i, 1).Font.ColorIndex <> 1 Then
textOut = textOut & Mid(cell, i, 1)
End If
Next
cell.Value = textOut
Next cell
End Sub
答案 1 :(得分:1)
试试这个:
*ngIf="(item.activityStatus!='Done')"