How do I use workbook.sheets.count

D

dradon

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.
 
P

PCLIVE

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
 
D

Don Guillett

right click the excel icon in the upper left corner>copy paste this>modify
to suit>save workbook.
Private Sub Workbook_Open()
Sheets("sheet1").Range("a1") = ActiveWorkbook.Sheets.Count
End Sub
 
Top