Start für UserForm ändern
11.01.2010 20:46:12
Rainer
Hallo,
habe in einer UserForm folgenden Code:
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim rZelle As Range
Dim sFundst As String
If Trim(TextBox1.Value) = "" Then
MsgBox "Bitte Thema eingeben!", _
48, " Hinweis für " & Application.UserName
Exit Sub
End If
With ThisWorkbook.Worksheets("Erfassung(2)").Columns(6)
Set rZelle = .Find(What:=Trim(TextBox1.Value), LookAt:=xlWhole, LookIn:=xlValues)
If Not rZelle Is Nothing Then
sFundst = rZelle.Address
Do
ListBox1.AddItem .Range("C" & rZelle.Row).Value
Set rZelle = .FindNext(rZelle)
Loop While Not rZelle Is Nothing And rZelle.Address <> sFundst
Else
MsgBox "Dieses Thema """ & TextBox1.Value & """ ist nicht vorhanden.", _
48, " Hinweis für " & Application.UserName
End If
End With
End Sub
Habe das Öffnen der UserForm abgeändert, so dass mir in TextBox1 gleich ein Wert aus der Tabelle übernommen wird.
Nun ist es eigentlich überflüssig, dass ich die ListBox1 durch Verlassen der TextBox aktiviere.
Was muss ich nun ändern, damit ich gleich beim öffnen die ListBox1 aktiviert habe?
Gruß Rainer