Deleting Sheets with @

  • Thread starter Thread starter ianripping
  • Start date Start date
I

ianripping

In my workbook I have a macro that creates some sheets with the@
character.

I would like to have a macro that looks for any sheets with the @
character and deletes them.

Something like

Sub DeleteSheet()
Application.DisplayAlerts = False
Sheets(@).Delete
Application.DisplayAlerts = True
End Sub

But obviously a macro that actually does this.

Any suggestions?
 
One way:

Public Sub DeleteATBooks()
Dim wkSht As Worksheet
Application.DisplayAlerts = False
For Each wkSht In Worksheets
With wkSht
If .Name Like "*@*" Then
If Worksheets.Count > 1 Then
.Delete
Else
MsgBox "Can't delete " & .Name & _
"-workbooks must have at least 1 worksheet."
End If
End If
End With
Next wkSht
Application.DisplayAlerts = True
End Sub
 
Ian,

Would this do the job for you ?

Sub DeleteIt()
A = Worksheets.Count
For I = 1 To A
If Worksheets(I).Name = "@" Then
Application.DisplayAlerts = False
Worksheets(I).Delete
Application.DisplayAlerts = True
Exit Sub
End If
Next
End Sub

--
Regards,
Auk Ales

* Please reply to this newsgroup only *
* I will not react on unsolicited e-mails *
 
Back
Top