ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I use workbook.sheets.count (https://www.excelbanter.com/excel-discussion-misc-queries/115247-how-do-i-use-workbook-sheets-count.html)

dradon

How do I use workbook.sheets.count
 
I want to use the code above but don't know anything about VBA. The goal is
to have the number worksheets displayed in cell A1 on the first worksheet
everytime I open this file.

PCLIVE

How do I use workbook.sheets.count
 
Press Alt+F11.
Double-click on 'ThisWorkbook'.
Paste the following code

Private Sub Workbook_Open()
Range("A1").Value = Sheets.Count & " Worksheets"
End Sub


HTH,
Paul

"dradon" wrote in message
...
I want to use the code above but don't know anything about VBA. The goal
is
to have the number worksheets displayed in cell A1 on the first worksheet
everytime I open this file.




Don Guillett

How do I use workbook.sheets.count
 
right click the excel icon in the upper left cornercopy paste thismodify
to suitsave workbook.
Private Sub Workbook_Open()
Sheets("sheet1").Range("a1") = ActiveWorkbook.Sheets.Count
End Sub


--
Don Guillett
SalesAid Software

"dradon" wrote in message
...
I want to use the code above but don't know anything about VBA. The goal
is
to have the number worksheets displayed in cell A1 on the first worksheet
everytime I open this file.





All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com