Question to overwriting a sheet
Hi Philipp
Sheet names must be unique in a workbook, because you may have formulas
saying
=Open Tickets!A1
So if you have to create a new sheet with this distinct name, you have to
rename the old one to something else first. This "something else" also has
to be unique (... and so on ;-)
HTH. Best wishes Harald
"Philipp Oberleitner" skrev i melding
...
I have the error that when i want to execute the macro again i get an
error
messsage cause teh sshet already exist , is there a way to overwrite it ?
Sub ShowOpenTickets()
Const Blatt1 = "2004-05-28_Auswertung_D2_VDF"
ActiveWorkbook.Worksheets.Add.Name = "Open Tickets"
Const Blatt2 = "Open Tickets"
Dim i As Integer
Dim iAnz As Integer
Application.ScreenUpdating = False
Sheets(Blatt1).Activate
Range("D1").Select
iAnz = 0
i = 0
Do Until i = ActiveSheet.UsedRange.Rows.Count
If ActiveCell.Value = "in work" Or ActiveCell.Value = "assigned" Then
Selection.EntireRow.Copy
Sheets(Blatt2).Activate
ActiveSheet.Paste
ActiveCell.Offset(1, 0).Select
Sheets(Blatt1).Select
ActiveCell.Offset(1, 0).Select
iAnz = iAnz + 1
Else
ActiveCell.Offset(1, 0).Select
End If
i = i + 1
Loop
Application.CutCopyMode = False
Application.ScreenUpdating = True
MsgBox "Es wurden " & iAnz & " Sätze übertragen"
End Sub
|