ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Using date as trigger for macro (https://www.excelbanter.com/excel-discussion-misc-queries/142270-using-date-trigger-macro.html)

Mike Milmoe

Using date as trigger for macro
 
I want to write a macro, that will look for today's date in a database, and
if it finds it, do another action. I have already designed the other action.

Thanks!

Mike

BigPig

Using date as trigger for macro
 
Hi Mike,

I'm no expert at macros, but you could try:

Worksheets(1).Range("a1") = ""
'dont forget to format cell a1 as the date that the other cell in your
database is.
Worksheets(1).Range("a1") = "=NOW()"

'where "worksheets(?).range("??").text" is the date somewhere in your
database. 'I used b1
If Worksheets(1).Range("a1").Text = Worksheets(1).Range("b1").Text Then
'if same do something
Worksheets(1).Range("c1").Value = "yep they're the same"
Else
'if not do something else
Worksheets(1).Range("c1").Value = "nope they're not"

End If


hth

BigPig

"Mike Milmoe" wrote:

I want to write a macro, that will look for today's date in a database, and
if it finds it, do another action. I have already designed the other action.

Thanks!

Mike


Gary''s Student

Using date as trigger for macro
 
Sub milmoe()
Set r = Range("A1:A100")
For Each rr In r
If rr.Value = DateValue(Now()) Then
MsgBox ("call your macro here")
End If
Next
End Sub

--
Gary''s Student - gsnu200720


"Mike Milmoe" wrote:

I want to write a macro, that will look for today's date in a database, and
if it finds it, do another action. I have already designed the other action.

Thanks!

Mike


Mike Milmoe

Using date as trigger for macro
 
This worked great. Thanks alot

Mike

"Gary''s Student" wrote:

Sub milmoe()
Set r = Range("A1:A100")
For Each rr In r
If rr.Value = DateValue(Now()) Then
MsgBox ("call your macro here")
End If
Next
End Sub

--
Gary''s Student - gsnu200720


"Mike Milmoe" wrote:

I want to write a macro, that will look for today's date in a database, and
if it finds it, do another action. I have already designed the other action.

Thanks!

Mike



All times are GMT +1. The time now is 06:17 PM.

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