Live-Forum - Die aktuellen Beiträge
Datum
Titel
24.04.2024 19:29:30
24.04.2024 18:49:56
Anzeige
Archiv - Navigation
208to212
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
208to212
208to212
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Verknüpfung Textfeld und Kombinationsfeld

Verknüpfung Textfeld und Kombinationsfeld von: Diver (adsbygoogle = window.adsbygoogle || []).push({}); Geschrieben am: 27.01.2003 - 15:50:49 Hallo Leute,wie bekomme ich es hin, daß wenn ich in einem Textfeld einen String eingebe automatisch in der Combobox danach gesucht wird und falls vorhanden auch dieser Eintrag selektiert wird. Es soll sowas wie eine Möglichkeit Complete geben, lt. Ms-Hilfe, aber mehr habe ich dazu nicht gefunden. ...evtl. ne Prozedur?Vielen Dank im Voraus.
27.01.2003 15:50:49
Diver
Hallo Leute,

wie bekomme ich es hin, daß wenn ich in einem Textfeld einen String eingebe automatisch in der Combobox danach gesucht wird und falls vorhanden auch dieser Eintrag selektiert wird. Es soll sowas wie eine Möglichkeit Complete geben, lt. Ms-Hilfe, aber mehr habe ich dazu nicht gefunden. ...evtl. ne Prozedur?

Vielen Dank im Voraus.

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
Re: Verknüpfung Textfeld und Kombinationsfeld
27.01.2003 16:10:11
ivan


hi 
also ich verwende das hier !!!
IST ECHT SUPER

'Aufbau: (UserForm)
'- 2 CommandButton (ComandButton1/CmdAbbruch)
'- 6 TextBoxen (txtAngebotNr/txtDatum/txtKunde/ect..)
'- 2 Listboxen (ListBox1/ListBox2)


Private Sub CmdAbbruch_Click()
    Unload Me
End Sub
Private Sub CommandButton1_Click()
    Dim s As String
    Dim Found As Range
    Dim FirstAddress As String
    Dim I As Integer    ' Zeile
    I = 0
    If txtSuche.Text = "" Then
        MsgBox "Kein Eintrag vorhanden!", vbCritical, "Was soll ich den suchen?"
        txtSuche.SetFocus
            Else
    End If
    Eingabe = txtSuche.Text
    If Eingabe = "" Then Exit Sub
    ListBox1.Clear
    ListBox2.Clear
    With ActiveSheet
        Set Found = .Cells.Find(Eingabe, LookAt:=xlPart)
        If Not Found Is Nothing Then
            FirstAddress = Found.Address
            ListBox1.ColumnCount = 2
            ListBox1.AddItem Found
            ListBox1.List(I, 1) = Cells(Found.Row, 13)
            ListBox2.AddItem Found.Row
            I = I + 1
            Do
                Found.Activate
                Set Found = Cells.FindNext(After:=ActiveCell)
                On Error Resume Next
                If Found.Address = FirstAddress Then Exit Do
                ListBox1.AddItem Found
                ListBox1.List(I, 1) = Cells(Found.Row, 13)
                ListBox2.AddItem Found.Row
                I = I + 1
            Loop
        End If
    End With
    CommandButton1.Caption = "Neue Suche"
End Sub

'##############################
'Hier erfolgt die Ausgabe des gesuchten
'in einer TextBox per Auswahl in der ListBox

Private Sub ListBox1_Click()
    If ListBox1.Value <> "" Then
        On Error Resume Next
        ListBox2.ListIndex = ListBox1.ListIndex
        txtAngebotNr = Cells(ListBox2.Value, 2)
        txtDatum = Cells(ListBox2.Value, 3)
        txtKunde = Cells(ListBox2.Value, 5)
        txtOrt = Cells(ListBox2.Value, 10) & " " & Cells(ListBox2.Value, 11)
        txtGesamtPreis = Cells(ListBox2.Value, 20) & " €"
        txtAuftragswert = Cells(ListBox2.Value, 21) & " €"
    End If
End Sub

'#################################
'Hier wird die betreffende Zeile markiert bei
'einem Doppelklick

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    If ListBox1.Value <> "" Then
        On Error Resume Next
        ListBox2.ListIndex = ListBox1.ListIndex
        Rows(ListBox2.Value).Select
    End If
End Sub

Private Sub UserForm_Activate()
        CommandButton1.Caption = "Suche"
End Sub


VIEL SPASS 
ivan
 

     Code eingefügt mit Syntaxhighlighter 1.16



Anzeige
Re: Verknüpfung Textfeld und Kombinationsfeld
27.01.2003 16:15:05
Steffan

Hi Taucher,

angenommen Du hast in Deinem Userform eine ComboBox1 und eine TextBox1, dann hilft Dir vielleicht folgender Code:


Private Sub TextBox1_Change()
For i = 0 To ComboBox1.ListCount - 1
    If InStr(1, ComboBox1.List(i), TextBox1.Text, vbTextCompare) <> 0 Then _
        ComboBox1.ListIndex = i: Exit For
Next
End Sub

 


Steffan.



Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige