Code- Optimierung
André
ich trage mittels nachfolgendem Code einen Schichtplan in einen
Kalender ein. Diesen Code habe ich von einem anderen Projekt in
jetzt abgeänderter Form übernommen.(Dank an Beni)
Nun zu meinem Problem, ich will 3 Spalten auf einmal eintragen.
Bis jetzt trage ich jede Spalte nacheinander ein. Das doch bestimmt
anders, aber wie ? (Hab schon viel probiert, aber komm einfach nicht drauf)
Ich hänge auch noch die Datei mit an, zum besseren Verständnis.
Sub Plan2004()
[A34] = 2004
Application.ScreenUpdating = False
a = 2
With Sheets("Plan_alle")
za = za + 26
If za > 30 Then za = za - 29
For e = 2 To 48 Step 4
For f = 3 To 33
If Cells(f, e - 1) = "" Then Exit For
Cells(f, e) = .Cells(za, a)
za = za + 1
If za = 30 Then za = 2
Next f
Next e
End With
b = 3
With Sheets("Plan_alle")
zz = zz + 26
If zz > 30 Then zz = zz - 29
For l = 3 To 48 Step 4
For k = 3 To 33
If Cells(k, l - 1) = "" Then Exit For
Cells(k, l) = .Cells(zz, b)
zz = zz + 1
If zz = 30 Then zz = 2
Next k
Next l
End With
sp = 4
With Sheets("Plan_alle")
z = z + 26
If z > 30 Then z = z - 29
For m = 4 To 48 Step 4
For i = 3 To 33
If Cells(i, m - 1) = "" Then Exit For
Cells(i, m) = .Cells(z, sp)
z = z + 1
If z = 30 Then z = 2
Next i
Next m
End With
Application.ScreenUpdating = True
End Sub
https://www.herber.de/bbs/user/5888.xls
Vielen Dank
und ein schönes Wochenende
AndréL.