Jetzt funktioniert zwar das Scrollen, aber nun habe ich aber das problem, dass ich wenn nun aus der Liste etwas auswählen will, dass ein Kombilierungsfehler kommt, dass die Variable "suche" nicht definiert ist.
Code:
Option Explicit
'optional
Dim ComboBoxRange As Range
Dim ComboBoxRange2 As Range
Dim myRange As Range
Dim NumRows
'optional
Private Sub ComboBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Call SetComboBoxHook(ComboBox1)
End Sub
Private Sub ComboBox1_LostFocus()
Call RemoveComboBoxHook
End Sub
Private Sub ComboBox2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Call SetComboBoxHook(ComboBox2)
End Sub
Private Sub ComboBox2_LostFocus()
Call RemoveComboBoxHook
End Sub
Private Sub UserForm_Activate()
Detailinformationen.Caption = "Detailinformationen über ein Panel"
Dim letzte As Long
letzte = Cells(Rows.Count, "Q").End(xlUp).Row
ActiveWorkbook.Worksheets("Top30").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Top30").Sort.SortFields.Add Key:=Range("Q6:Q" & letzte) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Top30").Sort
.SetRange Range("P6:BZ" & letzte)
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ComboBox1.List = Sheets("Top30").Range("Q6:Q" & letzte).Value
ComboBox2.List = Sheets("Top30").Range("Q6:Q" & letzte).Value
End Sub
Private Sub ComboBox1_Change()
Set suche = ThisWorkbook.Worksheets("Top30").Columns("Q").Find(what:=ComboBox1.Value, lookat:=xlWhole)
If Cells(suche.Row, "AD") = 1 Then
MsgBox "Detailinformationen zum Panel """ & ComboBox1.Value & """:" & String(2, vbNewLine) & _
Cells(suche.Row, "W") & String(1, vbNewLine) & _
"erste Auszahlung nach Anmeldung erfolgte nach: " & Cells(suche.Row, "AU") & String(1, vbNewLine) & _
Cells(suche.Row, "X") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AM") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AN") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AO") & String(1, vbNewLine) & _
"Ø Verdienst pro Tag: € " & Format(Cells(suche.Row, "AP"), "#,##0.00") & String(1, vbNewLine) & _
"Ø Verdienst pro Monat: € " & Format(Cells(suche.Row, "AQ"), "#,##0.00") & String(1, vbNewLine) & _
"Ø Verdienst pro Jahr: € " & Format(Cells(suche.Row, "AR"), "#,##0.00") & String(2, vbNewLine) & _
"Folgende Rangordnungen gibt es:" & String(1, vbNewLine) & _
Cells(suche.Row, "P") & ". Rang nach Beträgen" & String(1, vbNewLine) & _
Cells(suche.Row, "S") & ". Rang nach meisten Auszahlungen" & String(1, vbNewLine) & _
Cells(suche.Row, "U") & ". Rang nach der Häufigkeit"
Else
If Cells(suche.Row, "AD") = 2 Then
MsgBox "Detailinformationen zum Panel """ & ComboBox1.Value & """:" & String(2, vbNewLine) & _
Cells(suche.Row, "W") & String(1, vbNewLine) & _
"erste Auszahlung nach Anmeldung erfolgte nach: " & Cells(suche.Row, "AU") & String(1, vbNewLine) & _
Cells(suche.Row, "X") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AB") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AC") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AK") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AM") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AN") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AO") & String(1, vbNewLine) & _
Cells(suche.Row, "AS") & String(1, vbNewLine) & _
"Ø Verdienst pro Tag: € " & Format(Cells(suche.Row, "AP"), "#,##0.00") & String(1, vbNewLine) & _
"Ø Verdienst pro Monat: € " & Format(Cells(suche.Row, "AQ"), "#,##0.00") & String(1, vbNewLine) & _
"Ø Verdienst pro Jahr: € " & Format(Cells(suche.Row, "AR"), "#,##0.00") & String(2, vbNewLine) & _
"Folgende Rangordnungen gibt es:" & String(1, vbNewLine) & _
Cells(suche.Row, "P") & ". Rang nach Beträgen" & String(1, vbNewLine) & _
Cells(suche.Row, "S") & ". Rang nach meisten Auszahlungen" & String(1, vbNewLine) & _
Cells(suche.Row, "U") & ". Rang nach der Häufigkeit"
Else
If Cells(suche.Row, "AD") >= 3 Then
MsgBox "Detailinformationen zum Panel """ & ComboBox1.Value & """:" & String(2, vbNewLine) & _
Cells(suche.Row, "W") & String(1, vbNewLine) & _
"erste Auszahlung nach Anmeldung erfolgte nach: " & Cells(suche.Row, "AU") & String(1, vbNewLine) & _
Cells(suche.Row, "X") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AB") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AC") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AE") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AH") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AK") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AM") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AN") & String(1, vbNewLine) & _
" " & Cells(suche.Row, "AO") & String(1, vbNewLine) & _
Cells(suche.Row, "AS") & String(1, vbNewLine) & _
"Ø Verdienst pro Tag: € " & Format(Cells(suche.Row, "AP"), "#,##0.00") & String(1, vbNewLine) & _
"Ø Verdienst pro Monat: € " & Format(Cells(suche.Row, "AQ"), "#,##0.00") & String(1, vbNewLine) & _
"Ø Verdienst pro Jahr: € " & Format(Cells(suche.Row, "AR"), "#,##0.00") & String(2, vbNewLine) & _
"Folgende Rangordnungen gibt es:" & String(1, vbNewLine) & _
Cells(suche.Row, "P") & ". Rang nach Beträgen" & String(1, vbNewLine) & _
Cells(suche.Row, "S") & ". Rang nach meisten Auszahlungen" & String(1, vbNewLine) & _
Cells(suche.Row, "U") & ". Rang nach der Häufigkeit"
End If
End If
End If
End Sub
Private Sub ComboBox2_Change()
Set suche2 = ThisWorkbook.Worksheets("Auszahlungen").Columns("Q").Find(what:=ComboBox2.Value, lookat:=xlWhole)
MsgBox "Detailinformationen zum Panel """ & ComboBox2.Value & """:" & String(2, vbNewLine) & _
Worksheets("Auszahlungen").Cells(suche2.Row, "U") & String(1, vbNewLine)
End Sub