I have been running macros to add and delete worksheets during the development phase. At a certian point, the macro could not add another worksheet and I could not add one manually. When I closed the workbook and opened it again, everything worked normally. Resolved.
As a test, I ran the code below 4 times, in a new workbook, and created and deleted 50,000 worksheets in the same workbook. That tells me that there is no limit (that I will ever encounter) to the number of sheets created and deleted in a workbook.
Code:
Sub AddNewSheets()
Dim index As Integer
Dim index2 As Integer
For index2 = 1 To 50
Application.StatusBar = " processing " & index2
For index = 1 To 250
Worksheets.Add
Worksheets("Sheet1").Range("A1") = _
Worksheets("Sheet1").Range("A1") + 1
Next index
RemoveSheets
Next index2
Application.StatusBar = "Ready"
End Sub
Sub RemoveSheets()
Dim aSheet As Object
For Each aSheet In ActiveWorkbook.Sheets
If aSheet.Name <> "Sheet1" Then
Application.DisplayAlerts = False
Worksheets(aSheet.Name).Delete
Application.DisplayAlerts = True
End If
Next
End Sub