Hi All

I'm trying to an active-x button to allow the user to quickly remove certain sheets

The following script works:

Sub Delete()

    ActiveWindow.SelectedSheets.Delete

End Sub
But when I try to add an if statement around it, I get the following error:

Sub Delete()

Dim FirstSLA As String
FirstSLA = Sheet8.Range("B16").Value

If ActiveSheet.Name = FirstSLA Then
MsgBox "You cannot delete the fisrt SLA sheet"
End

Else

    ActiveWindow.SelectedSheets.Delete

End If

End Sub
Picture1.png

All the advice online says to turn off Application.DisplayAlerts, but I actually want them on as I do want the dialog box that asks the user if they're really sure

Any/all advice appreciated
All the best
Vicky