Replace the code with the following
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range, txt As String, x, i As Long, flg As Boolean, dg As Single
Const myCode = "SIMPLYWORK"
If Not Intersect(Target, Columns("e")) Is Nothing Then
Application.EnableEvents = False
For Each r In Intersect(Target, Columns("e"))
If Len(r.Value) Then
x = Split(StrConv(r.Text, vbUnicode), Chr(0))
For i = 0 To UBound(x) - 1
Select Case True
Case x(i) Like "[1-9]"
x(i) = Mid$(myCode, x(i), 1)
If flg Then x(i) = LCase$(x(i)): dg = dg + 1
If dg = 2 Then ReDim Preserve x(i): Exit For
Case x(i) = 0
x(i) = Mid$(myCode, 10, 1)
If flg Then x(i) = LCase$(x(i)): dg = dg + 1
If dg = 2 Then ReDim Preserve x(i): Exit For
Case x(i) = "."
If flg Then
If dg = 2 Then
ReDim Preserve x(i - 1)
Exit For
Else
x(i) = ""
End If
End If
flg = True
Case Else: x(i) = ""
End Select
Next
r.Value = Join$(x, "") & IIf(Not flg, ".", "") _
& String(2 - dg, Right$(LCase$(myCode), 1))
flg = False: dg = 0
End If
Next
End If
Application.EnableEvents = True
End Sub
Bookmarks