ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count numbers of times workbook opened (https://www.excelbanter.com/excel-programming/365149-re-count-numbers-times-workbook-opened.html)

Jim Thomlinson

Count numbers of times workbook opened
 
Normally I try not to shoot down a suggestion (just because it is different
from how I would go about it does not make it wrong... just different) but in
this case the code posted will cause problems.

The code posted is intended to be placed in ThisWorkbook. But the reference
is to A65500 which will be a problem as it will refer to cell 65,500 on
whichever sheet might happen to be active at the time the book is opened.
Next time it is opened it could be a different sheet. Also the cell is not
hidden from the end user who could delete it (intentioanlly or otherwise).
Also if a row is deleted or inserted on the sheet the value will be moved and
now the value will be lost. here is how I would go about it...

Create a new sheet called Variables (or whatever makes your heart go pitter
patter). The only thing this sheet will be used for is holding values that
the end user will never see.

In Cell A1 on the sheet add Workbook Opened (we will put the number of times
in Cell B1)

Private Sub Workbook_Open()
with sheets("Variables").range("B1")
.Value = .Value +1
msgbox "This book has been opened " & .Value & " times."
end with
sheets("Variables").visible = xlVeryHidden
End Sub

--
HTH...

Jim Thomlinson


"excelent" wrote:

my best ges:

Private Sub Workbook_Open()
MsgBox ("This file has been opened ") & [a65500] & " times"
[a65500] = [a65500] + 1
End Sub


excelent

Count numbers of times workbook opened
 
offcourse ir right Jim,- ges that 1 was too close to bedtime lol :-)


PSS

Count numbers of times workbook opened
 
this reply. I am using:
Public Sub Workbook_Open()
Range("N4").Select
ActiveCell = ActiveCell + 1
Range("M4") = "Opened:"
End Sub

It works great until my workbook becomes a "read only" on our sharepoint
site. Is
there any way around this???
Thanks!

--
J~


"Jim Thomlinson" wrote:

Normally I try not to shoot down a suggestion (just because it is different
from how I would go about it does not make it wrong... just different) but in
this case the code posted will cause problems.

The code posted is intended to be placed in ThisWorkbook. But the reference
is to A65500 which will be a problem as it will refer to cell 65,500 on
whichever sheet might happen to be active at the time the book is opened.
Next time it is opened it could be a different sheet. Also the cell is not
hidden from the end user who could delete it (intentioanlly or otherwise).
Also if a row is deleted or inserted on the sheet the value will be moved and
now the value will be lost. here is how I would go about it...

Create a new sheet called Variables (or whatever makes your heart go pitter
patter). The only thing this sheet will be used for is holding values that
the end user will never see.

In Cell A1 on the sheet add Workbook Opened (we will put the number of times
in Cell B1)

Private Sub Workbook_Open()
with sheets("Variables").range("B1")
.Value = .Value +1
msgbox "This book has been opened " & .Value & " times."
end with
sheets("Variables").visible = xlVeryHidden
End Sub

--
HTH...

Jim Thomlinson


"excelent" wrote:

my best ges:

Private Sub Workbook_Open()
MsgBox ("This file has been opened ") & [a65500] & " times"
[a65500] = [a65500] + 1
End Sub


Patrick Molloy

Count numbers of times workbook opened
 
checkout , save, and then checkin

"PSS" wrote in message
...
this reply. I am using:
Public Sub Workbook_Open()
Range("N4").Select
ActiveCell = ActiveCell + 1
Range("M4") = "Opened:"
End Sub

It works great until my workbook becomes a "read only" on our sharepoint
site. Is
there any way around this???
Thanks!

--
J~


"Jim Thomlinson" wrote:

Normally I try not to shoot down a suggestion (just because it is
different
from how I would go about it does not make it wrong... just different)
but in
this case the code posted will cause problems.

The code posted is intended to be placed in ThisWorkbook. But the
reference
is to A65500 which will be a problem as it will refer to cell 65,500 on
whichever sheet might happen to be active at the time the book is opened.
Next time it is opened it could be a different sheet. Also the cell is
not
hidden from the end user who could delete it (intentioanlly or
otherwise).
Also if a row is deleted or inserted on the sheet the value will be moved
and
now the value will be lost. here is how I would go about it...

Create a new sheet called Variables (or whatever makes your heart go
pitter
patter). The only thing this sheet will be used for is holding values
that
the end user will never see.

In Cell A1 on the sheet add Workbook Opened (we will put the number of
times
in Cell B1)

Private Sub Workbook_Open()
with sheets("Variables").range("B1")
.Value = .Value +1
msgbox "This book has been opened " & .Value & " times."
end with
sheets("Variables").visible = xlVeryHidden
End Sub

--
HTH...

Jim Thomlinson


"excelent" wrote:

my best ges:

Private Sub Workbook_Open()
MsgBox ("This file has been opened ") & [a65500] & " times"
[a65500] = [a65500] + 1
End Sub



All times are GMT +1. The time now is 02:05 PM.

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