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


ADVERTISEMENT

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 View Related

Return Time Intervals Based On X Minutes

Feb 20, 2008

I have a spreadsheet set up that has a series of timestamps and values. Please find a copy attached. I need to set up a macro that will allocate the timestamp in column C to an interval of time, e.g between 12:30 - 13:00.

To achieve this I tried to set the following code up in VBA, which would input a letter in a blank cell based on the time interval that the timestampin column C falls into, for example if the timestamp is > 12:30 and < 13:00 then "A"...the plan was to extend this concept to accomodate all of possible the time intervals I have.

Sub time_intervals()

Dim x As Integer
Dim lastrow As Long
Dim timeA As Date
Dim timeB As Date
Dim timeC As Date
Dim timeD As Date
Dim timeE As Date

The idea was that the timemaster value would be the timestamp in column C of my spreadsheet and the timeA,timeB,timeC etc would reference the timeintervals. However this does not seem to work as the value returned by my if statement is always incorrect - for example timemaster in cell C2 is less than timeA but the if statement always returns FALSE as opposed to "A"

View 4 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

Macro - Copy And Paste Based Upon Cell Formatting For Limited Time

Jun 27, 2013

Here is what I am trying to do in lay terms:

If A2 and B2 on Sheet("Master") are not highlighted, copy and paste them into Cell A3 and B3 on Sheet("Job List - Numeric"). Do this up to Row 50 on Sheet("Job List - Numeric"). Once Row 50 is filled, jump to pasting to D3 and E3 on Sheet("Job List - Numeric") and continue up to Row 50 and so on....

I need to do this on one sheet in numerical order based upon Column A and another sheet in alphabetical order based upon Column B.

Here is what I have in code so far:

Sub Final()
Application.ScreenUpdating = False
Dim c As Integer
Dim x As Integer
For Row = 2 To 145
Range(ActiveCell, Cells(ActiveCell.Row, ActiveCell.Column + 1)).Select

[Code] .......

View 3 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

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

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

Automatically Save As Date And Time Every X Minutes?

Jan 23, 2008

I want to write a piece of code that will automatically do a SaveAs on the workbook I'm using, say every hour, and add the current system date and time to the filename every time.

View 4 Replies View Related

Formula For Deduction Of Minutes Late Time In And Out?

May 13, 2014

All i want is to give solution for this time in and out.how to deduct late minutes to the salary of staff.

Date IN OUT
Thu 4/3/20149:1418:39
Sat 4/5/20149:0117:56
Sun 4/6/20148:5817:58
Mon 4/7/20149:1217:50
Tue 4/8/20149:1618:00
Wed 4/9/20149:0216:06
Thu 4/10/20149:1017:54

View 5 Replies View Related

Formula To Deal With Time, Hours & Minutes

Feb 1, 2010

I've got a worksheet that deals with dates and time. Similar to a checkbook, I need to take the balance and subtract what's taken from that. But the writer copied this from another software program and it's in this format. How do I convert it to a time format? Or is that what I really need? Right now the taken and balance are both in a general format.

I just need to know on any of the given days what the balance of this person's time was in hours and minutes.

View 2 Replies View Related

Calculate Time, But Round To Nearest 15 Minutes

Jan 2, 2007

I am trying to calculate the time between two cells and have the answer in hours, with two decimals, but in .25 minute increments.

Desired result:
1/1/07 12:00 in A1
1/1/07 14:10 in B1
1.25 in C1

0-7 Minutes - round down to 0.00
8-22 Minutes - round to 0.25
23-37 Minutes - round to 0.50
38-52 Minutes - round to 0.75
52-60 Minutes - round to 1.00

Because this is billable time, the number is never negative, so I don't need the formula to verify the first date/time cell is less than the second.

View 9 Replies View Related

Convert Time Range To Total Minutes

Feb 25, 2009

I have the following time ranges that need to be converted into total minutes. Examples (from easiest to most difficult)...

The items below are in column A (each range is the content of just one cell):

00:00-13:00
06:30-13:15
13:30-13:15 (this spans two days, so it's actually 23H and 45M)
23:30-03:00 & 16:00-22:10 (only the first time range matters; the second can be omitted)

So for 00:00-13:00, we have 13H and 0M = 13 * 60 = 780. And for 23:30-03:00, we have 3H and 30M = 3.5 * 60 = 210. But how do I automate this process with the text entries above (and hundreds more that are imported in this format).

View 9 Replies View Related

Adding Time :: Number Of Minutes Worked Each Day

Oct 25, 2009

I import via copy paste into excel from a timekeeping programme the following time I have worked each day, as an example:

Mon 7h 55m
Tues 6h 30m
Wed 7h 24m
etc

Is there a method of changing this in excel to work out the number of minutes I have worked each day? The timekeeping programme does not let me alter any parameters, so h & m is what I have.

View 9 Replies View Related







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