Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
delete sheet
You could use code like this to delete your worksheet and any Names
referencing it... Sub DeleteSheetAndItsNames() Dim N As Name Dim WS As String WS = "Sheet3" For Each N In ThisWorkbook.Names If Mid(Split(N.RefersTo, "!")(0), 2) = WS Then N.Delete Next Worksheets(WS).Delete End Sub Just change the worksheet name reference or, better still maybe, make it a Variant argument to the subroutine (then you can specify the worksheet name or number) so that your code can call it and specify the worksheet name or number when doing so. You can then, of course, bolster it up with some error checking. Rick "ranswrt" wrote in message ... I have a procedure to delete a sheet in a workbook. All the named cells in that sheet gets deleted. When I use the 'F3' to paste the list of named cells, the cells in the sheet that was deleted appear in it. Do I need to delete the named cells before I delete the sheet? Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete ROW on Sheet#1 corupts data on Sheet#2 | Excel Worksheet Functions | |||
Delete values in sheet 2 that arre found in sheet 1 | Excel Discussion (Misc queries) | |||
Why won't this sheet delete? | Excel Programming | |||
Delete rows from one sheet containing deatils on the second sheet | New Users to Excel | |||
delete content of one sheet off another sheet | Excel Programming |