mit dem Makro cboNamen5_Enter werden alle Datums aus der Spalte B in die CboNamen5 eingetragen.
Wenn ich jedoch eine Auswahl in der cboNamen5 vornehmen möchte so erfolgt kein Eintrag in die txtabl.....boxen.
Ändere ich jedoch im Tabellenblatt den Datumswert auf einen Textwert dann erfolgt der Eintrag in die TextBoxen.
wo müßte ich bitte in dem Makro cboNamen5_Change eine Änderung vornehmen, damit auch der Wert eines Datums in die Boxen eingetragen wird?
Private Sub cboNamen5_Enter()
Dim aRow, iRow As Long
Dim wks As Worksheet
Set wks = Workbooks("Gesundheitswesen Wien.xls").Worksheets("Jänner")
Dim col As New Collection
cboNamen5.Clear
'cboNamen3.Clear
aRow = IIf(IsEmpty(wks.Range("A65536")), wks.Range("A65536").End(xlUp).Row, 65536)
On Error Resume Next
For iRow = 2 To aRow
With wks
If .Cells(iRow, 2) = cboNamen6 Then
'col.Add wks.Cells(iRow, 1), wks.Cells(iRow, 3)
col.Add wks.Cells(iRow, 1), wks.Cells(iRow, 3).Text
If Err = 0 Then
cboNamen5.AddItem .Cells(iRow, 3).Text
Else
Err.Clear
End If
End If
End With
Next iRow
On Error GoTo 0
'Call Sortieren_CboN5
End Sub
Private Sub cboNamen5_Change()
On Error Resume Next
Dim r%
Dim Suche As Range
Dim wks As Worksheet
Set wks = Workbooks("Gesundheitswesen Wien.xls").Worksheets("Jänner")
'cboNamen5.Text = cboNamen5.Column(1) & " " & cboNamen5.Column(0)
Set Suche = wks.Range("C:C").Find(cboNamen5.Value, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows)
If (Not Suche Is Nothing) Then ' <-- hier der Test
r = Suche.Row
TextBox32.Text = Cells(r, 1) 'Datensatznummer
txtabl1.Text = Cells(r, 5)
txtabl2.Text = Cells(r, 6)
txtabl3.Text = Cells(r, 7)
txtabl4.Text = Cells(r, 8)
txtabl5.Text = Cells(r, 9)
txtabl6.Text = Cells(r, 10)
txtabl7.Text = Cells(r, 11)
txtabl8.Text = Cells(r, 12)
txtabl9.Text = Cells(r, 13)
txtabl10.Text = Cells(r, 14)
txtabl11.Text = Cells(r, 15)
txtabl12.Text = Cells(r, 16)
txtabl13.Text = Cells(r, 17)
txtabl14.Text = Cells(r, 18)
End If
End Sub
Danke
Josef