ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   A macro that counts the number of times a file is opened (https://www.excelbanter.com/excel-discussion-misc-queries/123215-macro-counts-number-times-file-opened.html)

[email protected]

A macro that counts the number of times a file is opened
 
Can a macro be written that will count the number of times a file has
been opened? If so, can the count be shown in a designated cell such
as A1. And would the count be affected if the file is saved under a
different name? If you know how to write such a macro, its formulation
would be much appreciated. Thanks.


Nick Hodge

A macro that counts the number of times a file is opened
 
Mr Lanier

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

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


wrote in message
ups.com...
Can a macro be written that will count the number of times a file has
been opened? If so, can the count be shown in a designated cell such
as A1. And would the count be affected if the file is saved under a
different name? If you know how to write such a macro, its formulation
would be much appreciated. Thanks.



Bob Flanagan

A macro that counts the number of times a file is opened
 
Just a caution - if a user has macros disabled (Excel's default), your macro
will not run

Bob Flanagan
Macro Systems
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, cell 302-584-1771
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

wrote in message
ups.com...
Can a macro be written that will count the number of times a file has
been opened? If so, can the count be shown in a designated cell such
as A1. And would the count be affected if the file is saved under a
different name? If you know how to write such a macro, its formulation
would be much appreciated. Thanks.





All times are GMT +1. The time now is 02:47 AM.

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