ich will mit einem Makro eines neuen Blatt erstellen. Der Name des Blatt ist aus eine Zelle vom ersten Blatt ("Sheet1") im selben Mappe. Deshalb habe ich ein Makro geschrieben, aber erscheint immer die Fehleranmeldung. Könnten sie mir weiter helfen?
......
Dim Zelle As Integer
Dim msg As Integer
Dim WS1 As Worksheet, WS2 As Worksheet
Dim Blatt As Worksheet
Set WS1 = Worksheets("Sheet1")
Zelle = Application.InputBox("Die Zeile der Zelle:", "Bitte eingeben")
With WS1
For Each Blatt In ActiveWorkbook.Worksheets
If Blatt.name = Left(.Cells(Zelle, "I").Value, 30) Then
msg = MsgBox("Das Blatt '" & .Cells(Zelle, "I").Value & "' besteht bereits." & vbLf & "Möchten Sie ein neues Blatt ersetzen?", 1 + vbQuestion, "Abfrage")
If msg = 1 Then
Application.DisplayAlerts = False
Sheets(Left(.Cells(Zelle, "I").Value, 30)).Delete
Application.DisplayAlerts = True
End If
If msg = 2 Then Exit Sub
End If
Next Blatt
If .Cells(Zelle, "I").Value "" Then
Worksheets.Add After:=Worksheets(Worksheets.Count)
ActiveSheet.name = Left(.Cells(Zelle, "I").Value, 30)
Else: GoTo Fehler2
End If
End With
Set WS2 = ActiveSheet
With WS2
......
......
......
End Sub
Danke! mfg
weilu