How do I know how many worksheets are in a workbook?

Source: Internet
Author: User

Method One

(1) Open the Tools menu and select the macro Visual Basic Editor command:

(2) In the Open window, select "Insert" → "module" command:

(3) Enter the following content:

Sub Sheetcount ()

Dim Num as Integer

Num=thisworkbook.sheets.count

Sheets (1). Select

Cells (=num)

End Sub

(4) To run the macro, the number in cell A1 of the first sheet in the workbook is the number of worksheets.

 Method Two

(1) Press "CTRL+F3" key to open the "Define name" dialog, define an X, enter "=get.workbook (4)" at "Reference location", then click the "OK" button:

(2) In any cell input "=x", the result is the number of worksheets.

  Method Three

Entering =info ("Numfile") cell properties in any cell is a general view of the number of worksheets that open all Excel files.

How do I know how many worksheets are in a workbook?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.