AddIn to delete sheet
This seems a reasonibly strange (if not dangerous) thing to want to do but:
Public Sub removeSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Debug.Print ws.Name
If ws.Name < "Sheet1" Then
Application.DisplayAlerts = False
Worksheets(ws.Name).Delete
Application.DisplayAlerts = True
End If
Next
End Sub
You might consider opening the workbooks as read-only so you don't
accidentally lose data.
- Rm
"Soniya" wrote:
Is it possible to restrict use of an addin to certain sheets?
for eg If the active workbook contains sheet ABC or DEF then delete the
sheet else run the function.
Thanks
|