Auto Run Macro Every X Minutes Or Time Specified In Cell

Sep 23, 2008

The below seems to work but I'm wondering if there might be a better way. I'm trying to keep an ongoing up-to- date and accurate time. my code is as follows:

Private Sub Workbook_Open() ' placed inside thisworkbook
Call TimeUp
End Sub

Sub UpdateTime() ' placed in module
If Range("A4") = TimeValue("00:00:00") Then
Application.OnTime Now + TimeValue("00:01:00"), "TimeUp"
Else
UpdateTime2
End If
End Sub

Sub TimeUp()
[a1] = Time
UpdateTime
End Sub

Sub UpdateTime2()
[a1] = Time
Application.OnTime Now + Range("A4").Value, "TimeUp"
End Sub

Does anyone know if there is any way to improve the Code or formulas within the Cells?

View 3 Replies


ADVERTISEMENT

Run Macro Based On Time In Cell Every X Minutes

Jan 26, 2008

1st post. Very basic understanding of Excel / Macros / VBA but I have searched and still not quite able to get what I'm looking for.

I would like to be able to manually put in a TIME in a cell, and have a macro run at set times before that TIME e.g. something like
If TIME in cell A1 =(hh:mm minus 30mins) run macro 1,
If TIME in cell A1 =(hh:mm minus 5mins) run macro 2

It was suggested to me to use vba code that would constantly check the time against the system time and as soon as it is 30 mins before the time in cell A1 and the 30 mins flag in cell B1 was ‘N’ then it would run macro 1 code and set the 30 mins flag to ‘Y’ to show that macro 1 had been run.

and that this could also do the same for the 5 mins event

View 4 Replies View Related

Decimal Time - Auto Sum Hours And Minutes Columns

Nov 21, 2012

I am a truck driver and keep a record of my loading times when I am loading and unloading. At the end of a trip i transfer all the data to my computer, then "auto sum" the "HOURS" and the "MINUTES" columns. At the bottom of ech trip I end up with figures, lets say 32 (hours) in column "J" and 303 (minutes) in column "K".

Now 303 minutes is {5 hours and 3 minutes}. Now we all know that mathematically we can work out that {3} minutes is 0.05 of 1 hour and that would make the total time worked 32 (hours) + 5 (hours(from the minutes)) + the last 3 minutes and the total is 37 hours and 3 minutes.

What I am in need of is a formula that will take the hours in column "J" add the hours from column "K", leaving the minutes to be converted to 0.05, giving me a total in cell "M29" that can then be multiplied by the wage rate in cell "M30", giving me an amount that I should be paid in cell "M31"

View 6 Replies View Related

Auto Save As VBA Macro Every X Minutes?

Dec 20, 2008

I have found some posts about "Auto Saving" and Dave pretty much frowns upon that. But the program I use (via ODBC), for some reason doesn't see the changes I make unless the file is saved. I have it auto-saving right now, but was thinking, maybe it is better to export a copy.

What I would need, is the ability to take my current workbook and export it to a new file (overwriting that same file each time), and do this based on time or (even better) on a change in the data. My current workbook is set to pull from other CSV files, scraping our website, etc., and then I use Excel to format the data the way I want.

It would be cool, if I could export two versions each time too... one that would be like a archive of what the file was like when it changed, the other would be the one that just gets overwritten each time.

Love this site...tons of info...but dang am I not smart at this stuff. Half the time, I don't even get where to put the code...worksheet, module, workbook?

View 6 Replies View Related

Time: The Next Cell Where It Would Say 4 Minutes 5.9 Seconds

Apr 23, 2006

I currently have a lot of times saved in an excel file that are in seconds for example 245.9 seconds. Need formula where i could have in the next cell to it where it would say 4 minutes 5.9 seconds.

View 2 Replies View Related

Add Time (minutes) Or Leave Cell Blank

Jun 18, 2014

cell A1 has the time (09:00), cell A2 has the minutes (60), cell A3 is the sum of A1+A2.

Im using this formula =A1+TIME(0,A2,0) - which is fine, except A1 is sometimes blank, so therefore I would like A3 to be blank.

I thought I could use this: =IF(A1,"","",(A1+TIME(0,A2,0)) But it doesn't work.

View 2 Replies View Related

Add 00:30 Minutes To Cell In Column F If Time Is Less Than 07:00 Hours

Oct 13, 2012

i need a vba code , i have time in column F like 8:30 , 3:30 , 5:30 , 8:30 , 9:30.......i need a macro which will add 00:30 in all cells in column F if time is less than 7.00 hrs

View 3 Replies View Related

Add This Number To The Start Time, Factor In Break Minutes And Get To The Projected Completion Time

Mar 3, 2009

I am trying to provide a tool for department leaders to monitor productivity for order processing in their departments. The variables I have are: Number of orders(variable), number of pickers (variable), start time(variable). Then, I know each order takes 1 picker 4 minutes to pick on average, and there are 45 minutes worth of breaks during the picking process. So after entering the variables I used =(((C3*4)/60)/D3) to come up with the time needed to process the orders. What I can't get to is how to add this number to the start time, factor in break minutes and get to the projected completion time. I have Excel 2003 at work. Clearly I need to take a class!

View 4 Replies View Related

Formula To Calculate Time Allotted Minus Time Used And Show Difference In Hour And Minutes?

Apr 27, 2014

Formula to calculate time allotted minus time used and show the difference in hour and minute.

View 1 Replies View Related

Auto Date And Time In A Macro

Nov 11, 2008

There is a standard Excel macro to add the current date and time to a spreadsheet. But how do you add those to another macro and have them populate the date and time as of when activate the second macro? I have the following code (only the part that is applicable for this question):

View 2 Replies View Related

Auto Save Backup Every 15 Minutes

May 22, 2012

I am looking for some code to auto save my workbook into this location every 15 min,

View 1 Replies View Related

Auto Open Excel For Every 30 Minutes

Jun 6, 2012

I have excel file in my desktop and doing some report generation with that. i need to open that excel file for every 30minutes.

View 5 Replies View Related

Auto Close Workbook If Kept Open For More Than 5 Minutes

Dec 21, 2006

I have an excel file stored on a network drive for the purpose of information sharing. (File protected with a password)

But some the guys leave the file open for quiet long time and hence I cannot open the file for updating the data.

-I need to have a macro that runs every 5 minutes and displays an alert message saying "Please close the File" as long as the file is kept open.

-A second macro with a modified version of the above to close the file automatically after 5 minutes from file opening time after showing an alert message "You cannot leave the File Open, File is Closed Automatically!"

View 9 Replies View Related

Format Time Cell For Greater Than 24 Hours: Hours & Minutes Only

Jan 29, 2010

Format Time Cell For Greater Than 24 Hours: Hours & Minutes Only .....

View 9 Replies View Related

Macro To Auto-populate Date And Time In Text Format

Jun 7, 2012

I think there's a way to use Excel to automatically create a 5-day calendar. Maybe a macro?

The date format must be dd/mm/yyyy hh:mm and it must be in text format. If its June 9, 2012 at 6pm - the correct format is: 12/06/2012 18:00

I want to post 5 times a day: 09:05, 9:55, 10:45, 16:55 and 18:00.

Column A is where the date and time goes. Ideally, I'd enter in A1 the start date and then run a macro that would automatically populate the next 5 consecutive days with the specific times above (so 25 rows total in column A).

I have to save the file as a csv file, so the date and time format has to be in text or I'll get an upload error in Hootsuite.

View 1 Replies View Related

Add Minutes To Time?

Sep 19, 2013

I have an issue with identifying start-stop times for special school bell schedule. Cell B2 is contains start time (7:50 AM) and D1 is the establish variable for class length (in this case 45 minutes). Passing time is constant (5 minutes), but needs to be added to the day schedule with the start of each class. I attempted to convert these value to minutes with no luck, same goes to formatting cells.

Hour
Start
End
Class Length
Passing Time

[Code]...

View 1 Replies View Related

Time To Minutes

Oct 21, 2008

I have a cell formatted as general that has need to be able to to take 21:56 and convert that to minutes. That is 21 hours 56 minutes to 1316 minutes. Then I need to add those minutes to a time to come up with like 19:14 + 1316 minutes = sometime the next day.

View 9 Replies View Related

Time 01:12:00 In Minutes

Feb 19, 2010

I have been racking my brains about this for the last hour without any joy. If I have a time value of say 01:12:00 in cell A1 (which is the difference between two other time values), but I want it displayed in minutes, so it displays 72 or 72:00 instead of 01:12:00 (which is 1 hour 12 minutes),

View 9 Replies View Related

Round Time To X Minutes

Aug 11, 2007

Is there a formua that can roundup the time duration to the nearest fifteen minutes?

Eg, if the time duration is 2hr 17 min, can it be rounded to 2hr 15 min?

If is 2hr 31 min, to be rounded to 2hr 30 min.

View 9 Replies View Related

Cell Auto-lock After Entering Time

Sep 16, 2013

I have created a time sheet and I would like to know if there is a way to auto-lock cells after time is entered so that it cannot be changed. As of right now I have employees enter the time by using Shift+Ctrl+;, so the exact time is recorded, however employees can write in whatever time they want. so I guess what I want to do is 2 things:

1- can the cell be formatted to only accept Shift+Ctrl+;, so that the exact time is entered in the cell and prevent employees from entering times they were not at work?

and

2- can the cell auto-lock after Shift+Ctrl+; is entered so that they can't modify the time sheet the next day if they arrived earlier than the day before?

View 5 Replies View Related

Time Conversion: Convert A Time From Hours/Minutes To Hours/Tenths

Oct 10, 2009

When I am converting a time from Hours/Minutes to Hours/Tenths, Excel is not converting it consitantely. EXAMPLE: 1:15 = 1.25. When I format the cell to present only one place past the decimal point, sometimes the cell will round up to 1.3, and other times it will round down to 1.2. What am I missing?

View 3 Replies View Related

Converting Time From Minutes To 100ths?

Jan 22, 2014

I have applied the excel suggestion to no success. Currently I take the hour and minutes and then manually use a time conversion chart to add. 3:00 PM to 4:10 PM will reflect 1:10 but adding time should convert to 1:17 (in 100ths)

View 1 Replies View Related

Adding 10 Minutes To Current Time

May 11, 2009

In one of the spreadsheets there is a need to have a 'action at' field.

This is the next five minute time slot between 5 and 10 minutes in the future (eg 10.51 -> 11.00 , 1.56 ->2.05 etc)

View 14 Replies View Related

Convert Time To Minutes In Userform

Jul 14, 2009

I know how to do this in a worksheet: =(b1-a1)*1440. B1 being the end time and A1 being the start time. I have a userform where the start time and end time are entered in text boxes. txtstart1 and txtend1. I would like the result to show up in txtmin1. Here is my code that doesnt work. I tried to convert code from a non-time sheet of mine. Dim as Integer may be the problem, I just learn as I go, and so far have only dealt with Integers.

View 4 Replies View Related

Extract Minutes And Seconds From A Time Value

Oct 20, 2009

I have a formula that gives me a time value (ie 12:53). I need to perform another formula that will use this data but I need the numbers seperated (12 in one cell and 53 in another)

In essence, what would be the formula to pull off the minutes number and the seconds number into individual cells. I know anything is possible in Excel, I just can't figure this one out.

View 2 Replies View Related

Adding Time :: By Hours And Minutes

Jun 4, 2006

If i have a start time of 5:00 am and a finishing time of 4:25 pm, what function do i use to get the total time of 11 hours & 25 minutes?

View 10 Replies View Related

Time Card & Sum Hours And Minutes

Dec 10, 2008

Just basic enter a start time in column A a finish time in column B and column C gives you total in hours and minutes and then maybe a way to sum those hours and minutes. how to do "Math" on time and how it should be entered (formatted) for it to work properly.

View 4 Replies View Related

Delete Time Entries Under 5 Minutes

Jun 9, 2009

i have a slight problem i have this script which i want to run on all worksheets which are numbered (i.e. 1,2,3,4 etc) and to delete the rows in the F128 range which is under 00:05:00. I just cant figure it out to get it working.

View 2 Replies View Related

Time Calculations - Getting Hours In Minutes

Feb 27, 2012

If I want to make a formula for a time such as

I have this time like 4:30 hour and i want to get this time by minutes like 270 minutes.

View 1 Replies View Related

Round Time To Nearest 15 Minutes

Oct 6, 2008

I need a formula to take an entered tim and rounded it to the nearest 1/4 hour

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved