Clever-Excel-Forum

Normale Version: Inhalt einer Userform-TextBox in Spalte vorhanden?
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Seiten: 1 2
Hallo Ralf,

Noch ein Hinweis zu Find, auch wenn Du Dich vielleicht schon für CountIf entschieden hast.
Die Konstruktion mit FindNext ist nicht nötig bw läuft sowieso nicht "im Kreis" Smile , da vor dem Loop das Exit Sub kommt. Es reicht also:

Code:
With objWsK.Range("A2:A" & loLetzte)
      Set c = .Find(TextBox1.Value, LookIn:=xlValues)
      If Not c Is Nothing Then
            frm_KdNr_vorhanden.Show                                          ' Fehlermeldung
            TextBox1.Value = ""                                              ' TextBox leeren
            TextBox1.SetFocus                                                ' Cursor in TextBox 1 zur Neueingabe
            Cancel = True
            Exit Sub
      Else
         strKdNr = TextBox1.Value                                            ' Übertrag Eingabe in Variable
      End If
   End With
Seiten: 1 2