Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Question to overwriting a sheet


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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging multiple sheets into one sheet without overwriting data. E. Miller Excel Worksheet Functions 0 March 6th 08 05:18 PM
overwriting my links Joanne New Users to Excel 2 January 18th 08 12:16 PM
Overwriting cells StephenAccountant Excel Discussion (Misc queries) 2 September 6th 07 12:36 PM
Overwriting most of a workbook Brad Excel Discussion (Misc queries) 3 July 2nd 07 02:42 PM
Overwriting data Cody Excel Discussion (Misc queries) 5 November 27th 05 02:40 AM


All times are GMT +1. The time now is 02:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"