Inserting and deleting worksheets

  • Thread starter Thread starter ChuckM
  • Start date Start date
C

ChuckM

I have 2 questions.

1. how to insert a worksheet and rename it
e.g. I want to add/insert a worksheet and name it "Summary"

2. how to detect the existance of a worksheet by name and then delete
it if it exists.
e.g. If a worksheet with the name "Data" exists...then delete
it.

thanks
chuck
 
Chuck

Sub alskdj()
For Each wkSht In Worksheets
With wkSht
If .Name = "Summary" Then
Application.DisplayAlerts = False
Sheets("Data").Delete
End If
End With
Next
Application.DisplayAlerts = True
End Sub


Sub zmxncbv()
Worksheets.Add.Name = "Summary"
End Sub

Gord Dibben Excel MVP
 
Back
Top