in short: is it possible to pass arguments to an OnTime event?
I have a list of different timevalues (hh:mm)
I am trying to create alarms based on those values; while passing an arguement (for examle the rownumber of the processed cell)
is there any way around this?for each cell in sheetname.range("A1:A10") ' all these cells contain different hh:mm values if (cell.value - timevalue("00:15:00")) > TimeValue(Now) then 'say the time now is 10:00 ; then the next bit of code will execute if the cellvalue = 10:16 or higher 'so far so good.. now 'if I try this (passing an argument to a function): Application.OnTime (cell.Value) - TimeValue("00:15:00"), alarm(cell.row) 'it will immediately execute the "alarm" function. (passing the argument) 'if I try this however (not passing any arguments, just calling a macro named "alarm"): Application.OnTime(cell.value) - TimeValue("00:15:00"),alarm 'it will run the "alarm" macro -when- the ontime-value is correct end if next cell
The only thing I can think of right now, is perhaps storing the cell.row in a public array that the macro reads upon execution..
My purpouse of passing the cellrow by the way, is to create an alarm that shows different values of different cells in that particular row.
for instance
msgbox("remember to do: " & sheetname.range( "x" & cvalue ).value)
EDIT
Found the solution here
the correcto code would for example be (a lot of commas in the passing argument)
Application.OnTime Now + TimeValue("00:00:02"), "'alarm cell.row'"
Last edited by wamp; 09-06-2010 at 06:32 AM. Reason: found solution
_______________________________________________
Remember:
Read the rules!
Use code tags! Place [CODE] before the first line of code and [/CODE] after the last line of code.
Mark your post [SOLVED] if it has been answered satisfactorily.
To do this, click EDIT in your original post, click GO ADVANCED and set the PREFIX. It helps everybody!
If you are approve (or disapprove) of any members response to your problem, please click theicon underneath their post and comment. It matters.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks