ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   First of the year (https://www.excelbanter.com/excel-programming/363861-first-year.html)

Oldjay

First of the year
 
I have a macro that runs by a command buttom. I want it to check each time
to see if it's after the first of the year, then display a warning message
and not display the messag again until it detects a new year

oldjay

Jim Cone

First of the year
 
Why not just look at the calendar?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

"Oldjay"
wrote in message
I have a macro that runs by a command buttom. I want it to check each time
to see if it's after the first of the year, then display a warning message
and not display the messag again until it detects a new year

oldjay

Norman Jones

First of the year
 
Hi OldJay,

Try:

'=============
Private Sub CommandButton1_Click()
On Error Resume Next
If Evaluate("DateTrigger") < Year(Date) Then
On Error GoTo 0

MsgBox "Year Change!"
Names.Add Name:="DateTrigger", _
RefersTo:=Year(Date)
End If

'your Code e.g.:
MsgBox "Hi"

End Sub
'<<=============


---
Regards,
Norman


"Oldjay" wrote in message
...
I have a macro that runs by a command buttom. I want it to check each time
to see if it's after the first of the year, then display a warning message
and not display the messag again until it detects a new year

oldjay




Oldjay

First of the year
 
People forget. That's why I need the code

"Jim Cone" wrote:

Why not just look at the calendar?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

"Oldjay"
wrote in message
I have a macro that runs by a command buttom. I want it to check each time
to see if it's after the first of the year, then display a warning message
and not display the messag again until it detects a new year

oldjay


Oldjay

First of the year
 
Thanks

"Norman Jones" wrote:

Hi OldJay,

Try:

'=============
Private Sub CommandButton1_Click()
On Error Resume Next
If Evaluate("DateTrigger") < Year(Date) Then
On Error GoTo 0

MsgBox "Year Change!"
Names.Add Name:="DateTrigger", _
RefersTo:=Year(Date)
End If

'your Code e.g.:
MsgBox "Hi"

End Sub
'<<=============


---
Regards,
Norman


"Oldjay" wrote in message
...
I have a macro that runs by a command buttom. I want it to check each time
to see if it's after the first of the year, then display a warning message
and not display the messag again until it detects a new year

oldjay






All times are GMT +1. The time now is 11:12 PM.

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