vba to delete worksheets

hi,

can someone help provide the code to delete the entire worksheet without prompting the user?

2 sheet names to delete are:
"Prev Year"
"Current Year"

Thanks,
jfrank85Asked:
Who is Participating?
 
Wilder1626Commented:
Or you can do this in case the sheet(s) don't exist:
On Error Resume Next
Application.DisplayAlerts = False
Sheets(Array("Current Year", "Prev Year")).Delete
Application.DisplayAlerts = True

Open in new window

0
 
Wilder1626Commented:
Hi

You can do this to delete both sheets:
Application.DisplayAlerts = False

    Sheets("Prev Year").Delete
    Sheets("Current Year").Delete

Application.DisplayAlerts = True

Open in new window

0
 
Saurabh Singh TeotiaCommented:
Alternatively you can also do...

Application.displayalerts=false

  Sheets(Array("Current Year", "Prev Year")).Delete

Application.displayalerts=true

Open in new window


Saurabh...
0
 
jfrank85Author Commented:
works perfect.
0
 
Wilder1626Commented:
I'm glad i was able to help
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.