Dim blattVorhanden As Boolean
Dim sh As Worksheet
blattVorhanden = False
For Each sh In ThisWorkbook.Sheets
If sh.Name = "Kopie" Then
blattVorhanden = True
Exit For
End If
Next sh
Sub aaa()
Dim blattVorhanden As Boolean
On Error Resume Next
blattVorhanden = Not Worksheets("Kopie") Is Nothing
On Error GoTo 0
MsgBox blattVorhanden
End Sub
Dim blattVorhanden As Boolean
Dim sh As Worksheet
For Each sh In ThisWorkbook.Sheets
If sh.Name = "Kopie" Then Exit For
Next sh
blattVorhanden = not sh is Nothing
On Error Resume Next
Set sh = Thisworkbook.Sheets
blattVorhanden = (Err = 0)
On Error Goto 0
Dim wsPunkte As Worksheet
Dim wsKopie As Worksheet
Dim letzteZeile As Long
Set wsPunkte = ThisWorkbook.Sheets("Punkte")
For Each wsKopie In ThisWorkbook.Worksheets
If wsKopie.Name = "Kopie" Then Exit For
Next
If wsKopie Is Nothing Then
wsPunkte.Copy after:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
Set wsKopie = ActiveSheet
wsKopie.Name = "Kopie"
End If
letzteZeile = wsKopie.Cells(wsKopie.Rows.Count, "A").End(xlUp).Row
If Evaluate("ISREF(Kopie!A1)") Then MsgBox "Vorhanden!"
Set wsPunkte = ThisWorkbook.Sheets("Punkte")
wsPunkte.Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
Set wsKopie = ActiveSheet
wsKopie.Name = "Kopie"
letzteZeile = wsKopie.Cells(wsKopie.Rows.Count, "A").End(xlUp).Row
If Not BlattVorhanden("Kopie") Thenund dann deinen Block zum erstellen angeben.
dim wsPunkte as worksheet
dim wsKopie as worksheet
dim letzeZeile as long
set wsPunkte = ThisWorkbook.Sheets("Punkte")
for each wsKopie in ThisWorkbook.Worksheets
if wsKopie.Name = "Kopie" then exit for
next
if wsKopie is Nothing then
set wsKopie = wsPunkte.Copy(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count))
wsKopie.Name = "Kopie"
end if
letzteZeile = wsKopie.Cells(wsKopie.Rows.Count, "A").End(xlUp).Row
Function BlattVorhanden(Name As String) As Boolean
On Error Resume Next
BlattVorhanden = IsObject(Sheets(Name))
End Function
If BlattVorhanden("Kopie") Then