View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Count the times a file is opened

Michael,
Is the code in the correct place ?
On the ThisWorkbook module.

And are events enabled ?
In the Immediate panes, what does this return
?Application.EnableEvents

NickHK

wrote in message
oups.com...
Can Excel count the number of times a file has been opened and place
the count in cell A1? I thought I had a solution when someone
suggested the following response, but I couldn't get it to execute.
Does anyone else have any suggestions? Thanks. Michael

You could use a Workbook_Open event thus

Private Sub Workbook_Open()
Worksheets("Tracker").Range("A1").Value = _
Worksheets("Tracker").Range("A1").Value + 1
End Sub


This put the value in A1 on a sheet called tracker, remember users have
a
habit of changing or deleting stuff, so you may want to hide the
worksheet.
To implement, right click on the small Excel icon for the workbook and
select view code. Paste the code here, save and close