Code that Exits on certain Dates

  • Thread starter Thread starter Seanie
  • Start date Start date
S

Seanie

I have some code that executes when a file is opened. What code could
I introduce that would exit if Today()= 15/12/08 or 16/12/08 or
17/12/08?

An ideal extension of the above would be on 15/12 or 16/12 or 17/12 in
any year (just so that I can future proof my code)

Thanks
 
In the ThisWorkbook code module, use code like

Private Sub Workbook_Open()
If (Month(Now) = 12) And _
(Day(Now) >= 15) And (Day(Now) <= 17) Then
Exit Sub
End If
'''''''''''''
' code to run other days goes here
'''''''''''''
End Sub


Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Mid-Month function help 3
Find then highlight in yellow 6
macro adding rows 8
Autofil on variable rows, delete extract and show remaining rows 3
Gears 14
Filter between Dates 2
For Loop 9
Date lies between 4

Back
Top