Lulle schrieb am 01.12.2010 11:02:33:
Hallo Serverus,
erstmal Danke für die Antwort!!! Ich glaube, dass ich das falsch ausgedrückt habe :) -tut mir leid…
Also noch mal:
Es sind vier Schichtviertel: A, B, C, D.
Z.B.: Am 1.1.10, von 6 – 18 Uhr arbeitete das A Viertel, von 18 – 6 Uhr das B Viertel ….
A Tag 1.1.10
B Nacht 1./2.1.10
D Tag 2.1.10
A Nacht 2/3.1.10
C Tag .
D Nacht
B tag
C tag
Dann geht es wieder von vorn los… bis zur Unendlichkeit ;)
A Tag 5.1.10
B Nacht 5./6.1.10
Du siehst, dass jeder Monat anders ist… Bei meiner Tabelle brauche ich nur den Tag.
Nochmals: VIELEN DANK FÜR DIE HILFE!!!!!!
Grüße,
Lulle
Sub Schicht()
Dim StartSchicht As String
Dim dJahr As Integer
Dim dMonat As Integer
Dim dTag As Integer
Dim LetzteZelle As String
dJahr = Application.InputBox(Prompt:="Welches Jahr?", Title:="Datum abfragen...", Type:=1)
dMonat = Application.InputBox(Prompt:="Welcher Monat?", Title:="Datum abfragen...", Type:=1)
Range("$A:$A").EntireColumn.ColumnWidth = 11
Range("$B$2:$AF$20").EntireColumn.ColumnWidth = 3
For dTag = 1 To Day(DateSerial(dJahr, dMonat + 1, 0))
Cells(6, dTag + 1) = Format(DateSerial(dJahr, dMonat, dTag), "ddd dd")
If dTag + 1 = 2 Then
StartSchicht = Application.InputBox(Prompt:="Welche Schicht am Monatsersten?", Title:="Schicht abfragen...", Type:=2)
Cells(7, dTag + 1) = StartSchicht
Else
Select Case Cells(7, dTag)
Case "C"
Cells(7, dTag + 1) = "B"
Case "B"
Cells(7, dTag + 1) = "A"
Case "A"
Cells(7, dTag + 1) = "D"
Case "D"
Cells(7, dTag + 1) = "C"
End Select
End If
Next dTag
End Sub
Severus |