Hi,
I have compose this solution:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng0 As Range ', cell As Range
Set rng0 = Intersect(Range("E:E,I:I"), Target)
On Error GoTo ws0_exit:
Application.EnableEvents = False
If Not rng0 Is Nothing Then
For Each cell In rng0
cell.Value = Replace(rng0, "?", "_", 1)
cell.Value = Replace(rng0, "", "_", 1)
cell.Value = Replace(rng0, "/", "_", 1)
cell.Value = Replace(rng0, "<", "_", 1)
cell.Value = Replace(rng0, ">", "_", 1)
cell.Value = Replace(rng0, """", "_", 1)
cell.Value = Replace(rng0, "*", "_", 1)
cell.Value = Replace(rng0, "|", "_", 1)
cell.Value = Replace(rng0, ":", "_", 1)
cell.Value = Replace(rng0, ";", "_", 1)
cell.Value = Replace(rng0, "[", "_", 1)
cell.Value = Replace(rng0, "]", "_", 1)
cell.Value = Replace(rng0, "+", "_", 1)
cell.Value = Replace(rng0, "{", "_", 1)
cell.Value = Replace(rng0, "}", "_", 1)
cell.Value = Replace(rng0, "~", "_", 1)
cell.Value = Replace(rng0, "`", "_", 1)
cell.Value = Replace(rng0, "!", "_", 1)
cell.Value = Replace(rng0, "@", "_", 1)
cell.Value = Replace(rng0, "#", "_", 1)
cell.Value = Replace(rng0, "$", "_", 1)
cell.Value = Replace(rng0, "%", "_", 1)
cell.Value = Replace(rng0, "^", "_", 1)
cell.Value = Replace(rng0, "&", "_", 1)
cell.Value = Replace(rng0, "=", "_", 1)
Next cell
End If
ws0_exit:
Application.EnableEvents = True
End Sub
You can add or remove any character from list by adding or removing the entire line.
This sub work in the worksheet where is inserted. It replace the character after you finish editing the cell ( after hit "Enter" or move with arrows ).