ich habe mal wieder ein Problem, mit dem ich alleine nicht fertig werde.
In Tabelle "Behandlung" habe ich 14 Spalten.
Spalte A "Datum" 1.1.2014 bis 31.12.2014
Spalte B "Zeit" 8:30 9:15 10:00 bis 19:00
Spalte C "Patient"
Spalte D "Anwendung"
Spalte E "Patient1"
Spalte F "Anwendung1"
bis Spalte N "Anwendung6"
Die Namen der Patienten können nur einmal pro ZEILE eingegeben werden, alledings
mehrmals pro SPALTE. z.B
- DATUM - ZEIT - PATIENT - ANWENDUNG
- 1.1.14 - 8:30 - Schmid - Behandlung
- DATUM - ZEIT - PATIENT1 - ANWENDUNG1
- 1.1.14 - 10:00 - Schmid - Massage
- DATUM - ZEIT - PATIENT4 - ANWENDUNG4
- 2.1.14 - 13:00 - Schmid - Gymnastik
Ich wähle über Combobox3 einen Namen (Schmid) aus und dann wird das Datum, die Zeit und der Name und die Anwendung in Listbox angezeigt. Leider aber nur die Werte bis Spalte "D". Die Werte aus Spalte "E" bis"N" sollen entsprechend auch aufgelistet werden. Das klappt bei mir leider nicht.
Vielleicht hat jemand eine Idee?
Private Sub ComboBox3_Change() 'patienten
Dim k As Long
Dim n As Long
Dim Suche As String
With Me
Sheets("Behandlung").Activate
Range("c:n").Select
Selection.Find(what:=.ComboBox3.Value, _
After:=ActiveCell, _
LookIn:=xlFormulas, lookat:=xlPart, _
searchorder:=xlByRows, searchdirection:=xlNext, _
MatchCase:=False).Activate
Suche = ComboBox3.List(ComboBox3.ListIndex, 0)
With Worksheets("Behandlung")
ListBox1.Clear
For k = 2 To .Cells(Rows.Count, 1).End(xlUp).row
If Suche = .Cells(k, 3).Value Then
ListBox1.AddItem
n = ListBox1.ListCount - 1
ListBox1.List(n, 0) = .Cells(k, 1).Value 'Datum
ListBox1.List(n, 1) = Format(.Cells(k, 2).Value, "hh:mm") 'Uhrzeit
ListBox1.List(n, 2) = .Cells(k, 3).Value 'Name
ListBox1.List(n, 3) = .Cells(k, 4).Value ' Behandlung
End If
Next
End With
End With
'On Error GoTo Fehler
'Fehler:
'MsgBox "Dieser Name ist nicht in Tabelle NAMEN vorhanden, oder muss bearbeitet werden!"
End Sub
Vielen Dank im VorausIngo