View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ben H Ben H is offline
external usenet poster
 
Posts: 18
Default Search and Delete

Hi all

I need to search through a wookbook for a chart and then if it is there,
delete it. Any ideas as to how to do this? I have tried this but it doesn't
work right.

Set wSheet = Sheets(strSurfPlotName)
If wSheet Is Nothing Then 'Doesn't exist

Set wSheet = Nothing
On Error GoTo 0
Else 'Does exist
Application.DisplayAlerts = False
Charts(strSurfPlotName).Delete
Application.DisplayAlerts = True
Set wSheet = Nothing
On Error GoTo 0
End If

it doesn't search right.

Thanks - Ben H