deleting wksts

K

kaj1104

Guys I have a problem

I created these procedures to execute when the file is opened. Th
Base Wksht gets created, however if I open it up again and the bas
wksht is already there it gives me an error. I need to have the bas
wkst recreated every time the file opens. So basically base wkst need
to be deleted before the program steps in copyinsameworkbook.

Can you guys help me out?


Sub auto_open()

CopyInSameWorkbook
End Sub




Sub CopyInSameWorkbook()
' Copying the entire sheet
Sheets("x").Select
Sheets("x").Copy Before:=Sheets(2)
Sheets(2).Name = "Base"
End Su
 
B

Bob Phillips

Sub auto_open()
application.displayalerts = False
On Error Resume Next
Sheets("Base").Delete
On Error Goto 0
Application.DisplayAlerts = True

CopyInSameWorkbook
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top