Count of File Opening

K

kdj

Hello

I would like to do the following: Whenever a certain
workbook is opened, a chronological number on the first
sheet should be increased by one.

Is there a count function for number of file openings?

Would really appreciate some help.

Thanks!
kdj
 
A

Alan

Put this in the ThisWorkbook window in the VBA editor

Private Sub Workbook_Open()
Sheets("Sheet1").Range("A1").Value = Sheets("Sheet1").Range("A1").Value + 1
End Sub

Change Sheet/Cell references to suit your needs

Note that this will only work if the workbook is saved each time its opened,
you could go

Private Sub Workbook_Open()
Sheets("Sheet1").Range("A1").Value = Sheets("Sheet1").Range("A1").Value + 1
ThisWorkbook.Save
End Sub

if you don't mind it being saved each time its closed, dodgy though if you
don't trust other users,
Regards,
Alan.
 

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