ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   deleting wksts (https://www.excelbanter.com/excel-programming/294327-deleting-wksts.html)

kaj1104

deleting wksts
 
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 Befo=Sheets(2)
Sheets(2).Name = "Base"
End Su

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

deleting wksts
 
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)

"kaj1104 " wrote in message
...
Guys I have a problem

I created these procedures to execute when the file is opened. The
Base Wksht gets created, however if I open it up again and the base
wksht is already there it gives me an error. I need to have the base
wkst recreated every time the file opens. So basically base wkst needs
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 Befo=Sheets(2)
Sheets(2).Name = "Base"
End Sub


---
Message posted from http://www.ExcelForum.com/




kaj1104[_3_]

deleting wksts
 
thanks that helped

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 04:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com