|
Option Explicit
Sub test()
Dim ar, i&, j&, Rng As Range, strTxt$
Set Rng = Range("C1", Cells(Rows.Count, "C").End(3))
With Rng
ar = .Value
For i = 2 To UBound(ar)
strTxt = ar(i, 1)
For j = Len(ar(i, 1)) To 1 Step -1
If .Cells(i, 1).Characters(j, 1).Font.Color = vbBlue Then
Select Case j
Case j = Len(ar(i, 1))
strTxt = Left(strTxt, Len(strTxt) - 1)
Case j = 1
strTxt = Right(strTxt, Len(strTxt) - 1)
Case Else
strTxt = Left(strTxt, j - 1) & Right(strTxt, Len(strTxt) - j)
End Select
End If
Next j
ar(i, 1) = strTxt
Next i
.Font.ColorIndex = 0
End With
[C1].Resize(UBound(ar)) = ar
Beep
End Sub
|
|