Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim re As Object, match As Variant, m As String, s As String
If Target.Cells.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
Application.EnableEvents = False
Set re = CreateObject("VBScript.RegExp")
re.Pattern = "w*"
re.IgnoreCase = True
re.Global = True
s = ""
If re.Test(Target) Then
For Each match In re.Execute(Target)
If match <> "" Then
m = ""
Select Case LCase(match)
Case "tonio"
m = "Antonio"
Case "pippo"
m = "Filippo"
Case "berto"
m = "Alberto"
End Select
If m <> "" Then s = s & m & " " Else s = s & match & " "
End If
Next
Target = RTrim(s)
End If
Application.EnableEvents = True
End Sub |