Count of File Opening

  • Thread starter Thread starter kdj
  • Start date Start date
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
 
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.
 
Back
Top