Hi, I'm trying to delete all the worksheets except for one called "macros" which contains all my macro buttons. I tried using this..
Sub delete_sheets()
bookname = ActiveWorkbook.Name
For i = 1 To ActiveWorkbook.Sheets.Count
Sheets(i).Select
If Sheets(i).Name <> "Macros" Then
ActiveSheet.Delete
End If
Next i
End Sub
I keep getting a subscript out of range error. Does anyone know what that means?
Thanks!
Sub delete_sheets()
bookname = ActiveWorkbook.Name
For i = 1 To ActiveWorkbook.Sheets.Count
Sheets(i).Select
If Sheets(i).Name <> "Macros" Then
ActiveSheet.Delete
End If
Next i
End Sub
I keep getting a subscript out of range error. Does anyone know what that means?
Thanks!