Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error trap the renaming of a sheet to an existing one
Hi,
I am using the following code to insert and rename a new worksheet with a user input variable Sheets.Add.Name = sname This works fine until the user trys to insert a sheet of the same name as an existing one. I can trap error 1004 but how can I delete the sheet that has just been inserted? I notice that when I insert a worksheet it always increments the sheet no. by 1 regardless of whether the previous worksheets exist eg I have just inserted a worksheet into my workbook that has only 1 other remaining worksheet, the others having been deleted, but it still gave it the default name of Sheet16 - Does access store the number of worksheets somewhere so that I can delete the max one? If not how would you suggest I go about deleting the latest inserted worksheet? Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error.Type or IsError to trap #VALUE! and #NUM! | Excel Worksheet Functions | |||
Error Trap Not Working | Excel Programming | |||
Trap a DateValue Error | Excel Programming | |||
error trap | Excel Programming |