Function for counting Worksheets?

J

JonWardellBuilders

I need to know a function that i can enter into a cell that will give me the
total number of worksheets i have in a specific Workbook.

it will serve as an invoice number because i create a new sheet for each
invoice i have.

thank you.
 
M

Mike H

Hi,

Alt +F11 to open VB editor. Right click 'This Workbook' and insert module
and paste the code below in. Call with

=numsheets()

Function numsheets()
numsheets = Worksheets.Count
End Function

Mike
 
S

ShaneDevenshire

Hi,

1. In the same cell in each sheet enter something (anything), say you enter
the date into cell A1 on each invoice, then

=COUNTA(Sheet1:Sheet300!A1)

Where Sheet1 is the first sheet in the workbook and Sheet300 is the last
sheet (left to right) in the spreadsheet. When you add a new sheet, insert
it between the first and last sheet. If necessary make Sheet300 a dummy with
nothing in it.

If this helps, please click the Yes button.
 

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

Top