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

Source: Internet
Author: User

Method One,

(1), open the Tools menu, select the macro Visual Basic Editor command, as shown in the figure:

(2), in the open window select the "Insert" → "module" command, as shown in the figure:

(3) Enter the following content, as shown in the picture:

Sub Sheetcount ()

Dim Num as Integer

Num=thisworkbook.sheets.count

Sheets (1). Select

Cells (1,1) =num

End Sub

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

Method Two,

(1) Press the "CTRL+F3" key combination, open the Define Name dialog box, define an X, enter "=get.workbook (4)" At the reference location, and then click OK, as shown in the picture:

(2) Enter "=x" in any cell, and the result is the number of worksheets.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.