Mattcarley724
New Member
- Joined
- Jun 4, 2021
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hello,
I am currently working on a project that calls to delete all strikethrough characters from a large excel sheet.
I have the code below working but only up to a limit of 256 characters, I believe it has something to do with cells.Characters but I have been unable to find a work around.
Thank you in advance.
I am currently working on a project that calls to delete all strikethrough characters from a large excel sheet.
I have the code below working but only up to a limit of 256 characters, I believe it has something to do with cells.Characters but I have been unable to find a work around.
VBA Code:
Sub RemoveText()
Dim X As Long, Cell As Range
For Each Cell In Selection
For X = Len(Cell.Text) To 1 Step -1
If Cell.Characters(X, 1).Font.Strikethrough = True Then Cell.Characters(X, 1).Text = ""
' Clean up spaces
If X > 1 Then
If Cell.Characters(X - 1, 2).Text = " " Then
Cell.Characters(X, 1).Text = ""
End If
ElseIf Cell.Characters(X, 1).Text = " " Then
Cell.Characters(X, 1).Text = ""
End If
Next
Next
End Sub
Thank you in advance.