Hi team, new user and not very comfortable with VBA. I am trying to have a macro run every day at a specific time interval. Right now I am using 2 modules. I was trying to set the below for 16:00:00. The code runs fine when I execute it but for some reason, it's not running on its own. Sometimes it has run on its own but I have no idea what was different... I tried a few different expressions with how you can use the ontime application. My goal is to just have the excel open and for it to run the macro. Thanks for the thoughts and help!
Module 1:
Sub Run_Time()
Application.OnTime "18:25:00", "Module2.Capture_Cell_Value"
End Sub
Module 2:
Sub Capture_Cell_Value()
Dim val As Variant
Sheets("Master").Select
val = Range("J17").Value
Sheets("Graph").Select
lRow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(lRow + 1, 2).Value = val
Cells(lRow + 1, 1).Value = Date
End Sub
Module 1:
Sub Run_Time()
Application.OnTime "18:25:00", "Module2.Capture_Cell_Value"
End Sub
Module 2:
Sub Capture_Cell_Value()
Dim val As Variant
Sheets("Master").Select
val = Range("J17").Value
Sheets("Graph").Select
lRow = Cells(Rows.Count, 1).End(xlUp).Row
Cells(lRow + 1, 2).Value = val
Cells(lRow + 1, 1).Value = Date
End Sub