Display sheets count on Message box
Private Sub CommandButton1_Click()
Dim j As Integer
j = ThisWorkbook.Sheets.Count
MsgBox j
Range("A1").Value = j
End Sub
State about Worksheets.count
Sheets creation: sheet number > sheets count
Private Sub CommandButton1_Click()
Dim i As Integer
For i = 1 To 11
If i > Sheets.Count Then
Worksheets.Add after:=Sheets(Worksheets.Count)
End If
Sheets(i).Name = CStr(MonthName(i, True))
Next
End Sub
Sheets creation: Number of sheets through INPUTBOX
Private Sub CommandButton1_Click()
Dim max As Integer
max = Application.InputBox("Enter the number")
For i = 1 To max
ThisWorkbook.Worksheets.Add after: Sheets (Sheets.Count)
ActiveSheet.Name = "day" & i
Next
End Sub