habe gerade nachfolgenden Code gebastelt.
Worksheets(n).name wird nicht in
Worksheets(n).Name umgewandelt!?
Gruß
Reinhard
Option Explicit
Sub Löschen()
Dim strAntwort As String, n As Byte
Application.ScreenUpdating = False
Application.Calculation = xlManual
Application.EnableEvents = False 'Ereignissprozeduren deaktivieren.
strAntwort = MsgBox("Achtung: Das gesamte Tabellenblatt wird zurückgesetzt!", _
vbExclamation + vbOKCancel, "Hinweis")
If strAntwort = vbCancel Then Exit Sub 'Bei "Abbrechen" abbrechen.
Call Lösch(ActiveSheet.name)
strAntwort = MsgBox("Die anderen Tabellenblätter ebenfalls zurücksetzen?", _
vbQuestion + vbYesNo + vbDefaultButton2, "Frage")
If strAntwort = vbYes Then
For n = 1 To Worksheets.Count
If Worksheets(n).name <> "Zusammenstellung" Then Call Lösch(Worksheets(n).name)
Next n
MsgBox "Alle Monate auf Null gesetzt.", vbInformation, "Information"
End If
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True 'Ereignissprozeduren aktivieren.
Application.ScreenUpdating = True 'Bildschirmaktualisierung einschalten.
End Sub
Sub Lösch(name As String)
Dim n As Byte
With Worksheets(name)
.Unprotect
.Range("H8:H38").ClearContents
For n = 8 To 38
.Cells(n, 7).FormulaLocal = "=Wenn(F" & n & ">0;""0:00"";"""")"
Next n
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End With
End Sub