'entwickelt von Winfried Radner 'e-mail: Wolf.W.Radzinski@onlinehome.de 'Benutzung frei - ohne Gewähr 'Modul1 enthält folgenden Code Function ersatz_text(s1 As String, s2 As String, t As String, pos As Integer) On Error Resume Next ersatz_text = "" If pos > 1 And s1 <> "" Then If pos < Len(t) Then ersatz_text = Left(t, pos - 1) t = Right(t, Len(t) - pos + 1) Else ersatz_text = t Exit Function End If End If lt = Len(t) ls = Len(s1) Do pos_is = InStr(1, t, s1) If pos_is > 0 Then ersatz_text = ersatz_text & Left(t, pos_is - 1) & s2 lt = lt - pos_is - ls + 1 t = Right(t, lt) End If Loop Until pos_is < 1 Or s1 = "" ersatz_text = ersatz_text & t End Function Sub ersatz_text_in_selection(ByVal s1 As String, ByVal s2 As String) Dim z, s As Range Dim sw As Worksheet Set sw = Application.ActiveWorkbook.ActiveSheet Set s = sw.UsedRange Application.Intersect(Selection, s).Select For Each z In Selection z.Value = ersatz_text(s1, s2, CStr(z), 1) Next End Sub Sub et_box() UserForm1.Show If UserForm1.Tag <> "1" Then Exit Sub s1 = UserForm1.TextBox1.Text s2 = UserForm1.TextBox2.Text Select Case Left(s1, 1) Case "#": If Left(s1, 2) = "##" Then s1 = Right(s1, Len(s1) - 1) Else s1 = use_chr_string(Right(s1, Len(s1) - 1)) End If Case Else: End Select Select Case Left(s2, 1) Case "#": If Left(s2, 2) = "##" Then s2 = Right(s2, Len(s2) - 1) Else s2 = use_chr_string(Right(s2, Len(s2) - 1)) End If Case Else: End Select Call ersatz_text_in_selection(s1, s2) End Sub Function use_chr_string(s As String) As String use_chr_string = "" Do param = InStr(1, s, ",") If param > 1 Then wert = Left(s, param - 1) s = Right(s, Len(s) - param) Else wert = s End If use_chr_string = use_chr_string & Chr(wert) Loop Until param = 0 End Function 'Userform1 hat 2 Textfelder für Parameterübergabe 'einen OK- und einen Abbruch-Button Private Sub CommandButton1_Click() 'caption=ok UserForm1.Tag = 1 UserForm1.Hide End Sub Private Sub CommandButton2_Click() 'caption=abbruch UserForm1.Tag = 0 UserForm1.Hide End Sub