Hallo Uwe!
Danke für Deine Antwort!
Nachdem ich laut Deinen Anweisungen folgenden Code fertiggestellt hatte wollte ich diesen ausführen. Es werden jedoch keine Einträge in die Textboxen gemacht. Habe ich hier noch was falsch gemacht?
Der Vorgang sollte folgender sein:
Wenn der Wert im Tabellenblatt "Schalter" in der Zelle D2 ein Datum ist und der erste Tag entweder der2. oder der 3 Tag sowie der Monat Jänner ist und wenn der Wert im Arbeitsblatt"Daten" in der Zelle AQ1 ident ist mit dem Eintrag in der TextBox5 und die Caption im schaltLabel ident ist mit dem Wert im Arbeitsblatt "Daten" dann soll der richtige Wert in die richtige TextBox geschrieben werden.
Private Sub CommandButton5_Click()
Dim wks As Worksheet
Dim wks1 As Worksheet
Set wks = Workbooks("Gesundheitswesen Wien.xla").Worksheets("Daten")
Set wks1 = Workbooks("Gesundheitswesen Wien.xls").Worksheets("Schalter")
If IsDate(TextBox5) Then
If wks1.Cells(2, 4) = Day(TextBox5) = 2 Or (Day(TextBox5) = 3 And Month(TextBox5) = 1) Then
Select Case TextBox3.Text
Case wks.Cells(1, 43)
If schaltLabel2.Caption = wks.Cells(6, 42) Then
TextBox6.Text = wks.Cells(6, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel3.Caption = wks.Cells(7, 42) Then
TextBox11.Text = wks.Cells(7, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel4.Caption = wks.Cells(8, 42) Then
TextBox16.Text = wks.Cells(8, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel5.Caption = wks.Cells(10, 42) Then
TextBox21.Text = wks.Cells(10, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel6.Caption = wks.Cells(11, 42) Then
TextBox26.Text = wks.Cells(11, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel7.Caption = wks.Cells(17, 42) Then
TextBox31.Text = wks.Cells(17, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel8.Caption = wks.Cells(21, 42) Then
TextBox36.Text = wks.Cells(21, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel9.Caption = wks.Cells(5, 42) Then
TextBox41.Text = wks.Cells(5, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel10.Caption = wks.Cells(15, 42) Then
TextBox46.Text = wks.Cells(15, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel11.Caption = wks.Cells(9, 42) Then
TextBox51.Text = wks.Cells(9, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel12.Caption = wks.Cells(12, 42) Then
TextBox56.Text = wks.Cells(12, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel13.Caption = wks.Cells(13, 42) Then
TextBox61.Text = wks.Cells(13, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel14.Caption = wks.Cells(16, 42) Then
TextBox66.Text = wks.Cells(16, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel15.Caption = wks.Cells(14, 42) Then
TextBox71.Text = wks.Cells(14, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel16.Caption = wks.Cells(18, 42) Then
TextBox76.Text = wks.Cells(18, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel17.Caption = wks.Cells(22, 42) Then
TextBox81.Text = wks.Cells(22, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel18.Caption = wks.Cells(20, 42) Then
TextBox86.Text = wks.Cells(20, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel19.Caption = wks.Cells(19, 42) Then
TextBox90.Text = wks.Cells(19, 43)
End If
Case wks.Cells(1, 43)
If schaltLabel20.Caption = wks.Cells(2, 42) Then
TextBox94.Text = wks.Cells(2, 43)
End If
End Select
End If
End If
End Sub
Danke
Josef