View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ExcelMonkey ExcelMonkey is offline
external usenet poster
 
Posts: 553
Default Deleting Custom Views when Deleting Sheets

I have a routine which deletes worksheets in a workbook. When I delete the
worksheets, I want to ensure that the custom views on those sheets are
deleted as well. Is there a way when deleting a sheet to test to see if it
has a custom view on that sheet? Does the view have a property that
identifies the sheet its on?

If not, is there a way to test to see if a custom view is still relevant? I
know that when I delete sheets, the views stay behind. If you try to
manually select the view an error message is NOT generated. As such its not
obvious that it no longer is relevant. The Show method below would not
generate an error message in VBA if the view it is attempting to show was
missing.

ActiveWorkbook.CustomViews("Condensed Consolidated Summary 1").Show

Thanks

EM