In einer Eingabemaske ist ein Listbox drin. In Listbox werden erscheint die Informationen, die vorab bei Checkbox 4 und 5 selektiert werden.
D.H. wenn ich in Checkbox 5 anklicke, wird in Combobox werte von Spalte C2:C2000) erscheint, die von 10 bis 2050 varieren.
Wenn ich in Combox 10 z.b. auswähle, dannden Commandbutton "Suche" klicke, dann sollten Alle Namen von Spalte B erscheinen, die z.B. Note 10 in Spalte C haben. Leider das Makro berücksichtigt nicht nur die Note 10 in Spale C sondern auch die Noten 10 in anderen Spalten...
Hier ist die Code:
Private Sub Suchen()
Application.ScreenUpdating = False
ListBox1.Clear
Dim rng As Range
Dim sAddress As String, Was As String
Dim rowFund As String
If CheckBox4 = Enabled Then Was = ComboBox2.Text
If CheckBox5 = Enabled Then Was = ComboBox2.Text
Set rng = ActiveSheet.Cells.Find(what:=Was, LookIn:=xlValues, MatchCase:=False)
If Not rng Is Nothing Then
sAddress = rng.Address
Do
Application.Goto rng, True
rowFund = ActiveCell.Row
ListBox1.AddItem rowFund & " - " & Cells(rowFund, "B") & " - " & Cells(rowFund, "C") _
_
Set rng = Cells.FindNext(After:=ActiveCell)
If rng.Address = sAddress Then Exit Do
Loop
End If
Set rng = Nothing
Application.ScreenUpdating = True
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim Zeichen As String, rowEintrag As String
Zeichen = 1
Zeichen = InStr(Zeichen, ListBox1.Value, "-")
rowEintrag = Left(ListBox1.Value, Zeichen - 2)
?bersicht.TextBox1 = Cells(rowEintrag, 2)
?bersicht.TextBox2 = Cells(rowEintrag, 3)
?bersicht.TextBox4 = Cells(rowEintrag, 7)
?bersicht.TextBox6 = Cells(rowEintrag, 9)
?bersicht.TextBox8 = Cells(rowEintrag, 11)
?bersicht.TextBox10 = Cells(rowEintrag, 13)
?bersicht.TextBox12 = Cells(rowEintrag, 15)
?bersicht.TextBox14 = Cells(rowEintrag, 17)
?bersicht.TextBox16 = Cells(rowEintrag, 19)
?bersicht.TextBox18 = Cells(rowEintrag, 21)
?bersicht.TextBox20 = Cells(rowEintrag, 23)
?bersicht.TextBox22 = Cells(rowEintrag, 26)
?bersicht.TextBox24 = Cells(rowEintrag, 28)
?bersicht.TextBox26 = Cells(rowEintrag, 29)
UserForm_Initialize2
End Sub
Private Sub CheckBox4_Click()
If CheckBox4 = Enabled Then
CheckBox5 = Not Enabled
ComboBox2.List = ActiveSheet.Range("B2:B2000").Value
End If
End Sub
Private Sub CheckBox5_Click()
If CheckBox5 = Enabled Then
CheckBox4 = Not Enabled
ComboBox2.List = ActiveSheet.Range("C2:C2000").Value
End If
End Sub
Ich denke ich muss irgendwie die rowFund = ActiveCell.Row ändern... Sie soll nur Spalte A und B berücksichtigen. Kann mir bitte jemand helfen?
Danke schön!