Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Macro - Conditional Auto_Open

Status
Not open for further replies.

meagain

MIS
Nov 27, 2001
112
CA
I've set up an Auto_Open macro which I only want to run if the date in a cell (let's say it is cell A1) does not equal today's date.

What's my best option for making this work?

Thank you :)
 
Something like this ?
With Worksheets("sheet name").Range("A1")
If IsDate(.Value) And .Value = Date Then Exit Sub
End With

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV,

I couldn't get it to work, so I opted for another solution as follows;

[blue]If Sheets("yesd").Range("A7").Value = 0 Then
MsgBox "Yesterday adjusted earlier today", 48, "END CODE"
Exit Sub
End If[/blue]

In the "yesd" sheet in cell A3 is =today()
In the "yesd" sheet in cell A5 is a pastespecial-value of cell A3 the last time the macro ran
In the "yesd" sheet in cell A7 is =A3-A5

Therefore when the workbook is open on the same day the macro will not
run because the value in cell A7 is 0

Thanks for making me re-adjust my thinking. [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top