Code not clearing sheet

The code below should delete a sheet (Report) and clear another (Filtered_Data).
It does delete the Report sheet but does not clear the Filtered_Data.
Can anyone help?

Public Sub DELETE_CLEAR()
 
  Application.DisplayAlerts = False
  
  On Error Resume Next
  
  Worksheets("Report").Delete
  Worksheets("Filtered_Data").Cells.Clear
  On Error GoTo 0
  
  
  
  Application.DisplayAlerts = True
  
End Sub

Open in new window

Euro5Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nutschCommented:
Can you remove the on Error Resume Next line and share the error message you're getting? The sheet might be protected, or the sheet name not be spelled correctly.

Thomas

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rspahitzCommented:
Also check the spelling of the sheet "Filtered_Data" and ensure that it has an underscore (or otherwise matches the sheet name)
Martin LissOlder than dirtCommented:
If the sheet is protected then do this

Public Sub DELETE_CLEAR()
 
  Application.DisplayAlerts = False
  
  On Error Resume Next
  
  Worksheets("Report").Delete
  With Worksheets("Filtered_Data")
        .Unprotect ' Password = "my password"
        .Cells.Clear
        .Protect UserInterfaceOnly:=True ', Password = "my password"
  End With
On Error GoTo 0

Open in new window

Euro5Author Commented:
The sheet was not protected, so I pasted in the name of the sheet from the source and it worked!? :)
THANKS!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.