Function AddSpaces(Txt As String)
Dim i As Integer
AddSpaces = Left(Txt, 1)
For i = 2 To Len(Txt)
If IsNumeric(Mid(Txt, i, 1)) Then
If Not IsNumeric(Mid(Txt, i - 1, 1)) Then
AddSpaces = AddSpaces & " " & Mid(Txt, i, 1)
Else
AddSpaces = AddSpaces & Mid(Txt, i, 1)
End If
If Not IsNumeric(Mid(Txt, i + 1, 1)) Then
AddSpaces = AddSpaces & " "
End If
Else
AddSpaces = AddSpaces & Mid(Txt, i, 1)
End If
Next i
End Function
Dim iCTR As Integer
Dim previousCharacter As Boolean
Dim newValue As String
For iCTR = 1 To Len(Range("A1").Value)
If iCTR = 1 Then
previousCharacter = IsNumeric(Mid(Range("A1").Value, iCTR, 1))
newValue = Mid(Range("A1").Value, iCTR, 1)
End If
If iCTR > 1 Then
If IsNumeric(Mid(Range("A1").Value, iCTR, 1)) = previousCharacter Then
newValue = newValue & Mid(Range("A1").Value, iCTR, 1)
previousCharacter = IsNumeric(Mid(Range("A1").Value, iCTR, 1))
Else
newValue = newValue & " " & Mid(Range("A1").Value, iCTR, 1)
previousCharacter = IsNumeric(Mid(Range("A1").Value, iCTR, 1))
End If
End If
Next iCTR
Range("A1").Value = newValue
Function Ins_Space(s As String)
With CreateObject("vbscript.regexp")
.Global = True
.Pattern = "(\d+)"
Ins_Space = Trim(.Replace(s, " $1 "))
End With
End Function