Counting Worksheets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to have the workbook count sheets and then have a message pop
up when it reaches a certain number?
 
Something like this put in the ThisWorkbook code module:

Private Sub Workbook_NewSheet(ByVal Sh As Object)
If Sheets.Count > 3 Then MsgBox "Too many sheets."
End Sub

Mike F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top