I have cells with partial strikethrough. In order to make easier to read, i'd like to delete it.
I've found this VBA, but it doesnt keep the color, or the bold characters.
Any chance you can help me on this?
PS: All the cells with text start with '
Sub DelStrikethroughText()
Dim xRg As Range, xCell As Range
Dim xStr As String
Dim I As Long
On Error Resume Next
Set xRg = Application.InputBox("Please select range:", "KuTools For Excel", Selection.Address, , , , , 8)
If xRg Is Nothing Then Exit Sub
Application.ScreenUpdating = Fase
For Each xCell In xRg
If IsNumeric(xCell.Value) And xCell.Font.Strikethrough Then
xCell.Value = ""
ElseIf Not IsNumeric(xCell.Value) Then
For I = 1 To Len(xCell)
With xCell.Characters(I, 1)
If Not .Font.Strikethrough Then
xStr = xStr & .Text
End If
End With
Next
xCell.Value = xStr
xStr = ""
End If
Next
Application.ScreenUpdating = True
End Sub
You can't replace the value in a cell with partial formatting without losing any per-character formatting.
If you need to remove text then do that using the
Characters()methods.