Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure if I really have the subject proper or not. This is what I want to
do. We have a spreadsheet that we keep individual workers times on. Every day, we have to take their time sheet and figure the amount of time worked, then enter it into the sheet. The times are truncated to the nearest 10th of a minute. IOW, 11:12 is 11.2 but so is 11:13 thru 11:17. What I'd like to do is on a control key sequence, pop up a box to enter the starting and ending time, then when <OK is pressed or clicked, or when you hit enter, have it calculate the time to the tenth, and insert it in whatever field the cursor is in at that point. Any help??? Thanks!! Shawn |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "43fan" wrote in message ... Not sure if I really have the subject proper or not. This is what I want to do. We have a spreadsheet that we keep individual workers times on. Every day, we have to take their time sheet and figure the amount of time worked, then enter it into the sheet. The times are truncated to the nearest 10th of a minute. IOW, 11:12 is 11.2 but so is 11:13 thru 11:17. What I'd like to do is on a control key sequence, pop up a box to enter the starting and ending time, then when <OK is pressed or clicked, or when you hit enter, have it calculate the time to the tenth, and insert it in whatever field the cursor is in at that point. Any help??? Thanks!! Shawn |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Shawn,
Not sure if I have got the rounding correct, but try this. It will change the amount on input Private Sub Worksheet_Change(ByVal Target As Range) Dim nAmount As Double On Error GoTo ws_exit: Application.EnableEvents = False With Target nAmount = Int(.Value * 24) / 24 + _ Round((.Value * 24 - _ Int(.Value * 24)) * 6, 0) / 6 / 24 .Value = nAmount End With ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "43fan" wrote in message ... Not sure if I really have the subject proper or not. This is what I want to do. We have a spreadsheet that we keep individual workers times on. Every day, we have to take their time sheet and figure the amount of time worked, then enter it into the sheet. The times are truncated to the nearest 10th of a minute. IOW, 11:12 is 11.2 but so is 11:13 thru 11:17. What I'd like to do is on a control key sequence, pop up a box to enter the starting and ending time, then when <OK is pressed or clicked, or when you hit enter, have it calculate the time to the tenth, and insert it in whatever field the cursor is in at that point. Any help??? Thanks!! Shawn |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob,
Thanks! But, very much a beginner here, and, I'm not sure how to "run" this... Thanks again! Shawn "Bob Phillips" wrote in message ... Shawn, Not sure if I have got the rounding correct, but try this. It will change the amount on input Private Sub Worksheet_Change(ByVal Target As Range) Dim nAmount As Double On Error GoTo ws_exit: Application.EnableEvents = False With Target nAmount = Int(.Value * 24) / 24 + _ Round((.Value * 24 - _ Int(.Value * 24)) * 6, 0) / 6 / 24 .Value = nAmount End With ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "43fan" wrote in message ... Not sure if I really have the subject proper or not. This is what I want to do. We have a spreadsheet that we keep individual workers times on. Every day, we have to take their time sheet and figure the amount of time worked, then enter it into the sheet. The times are truncated to the nearest 10th of a minute. IOW, 11:12 is 11.2 but so is 11:13 thru 11:17. What I'd like to do is on a control key sequence, pop up a box to enter the starting and ending time, then when <OK is pressed or clicked, or when you hit enter, have it calculate the time to the tenth, and insert it in whatever field the cursor is in at that point. Any help??? Thanks!! Shawn |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Shawn,
The details on installing it were appended with the message. To run it, just put a time in a cell, like 11:12, and watch it change. You may want the changing cells to be limited to a certain range, if so post back and I will; amend. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "43fan" wrote in message ... Bob, Thanks! But, very much a beginner here, and, I'm not sure how to "run" this... Thanks again! Shawn "Bob Phillips" wrote in message ... Shawn, Not sure if I have got the rounding correct, but try this. It will change the amount on input Private Sub Worksheet_Change(ByVal Target As Range) Dim nAmount As Double On Error GoTo ws_exit: Application.EnableEvents = False With Target nAmount = Int(.Value * 24) / 24 + _ Round((.Value * 24 - _ Int(.Value * 24)) * 6, 0) / 6 / 24 .Value = nAmount End With ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "43fan" wrote in message ... Not sure if I really have the subject proper or not. This is what I want to do. We have a spreadsheet that we keep individual workers times on. Every day, we have to take their time sheet and figure the amount of time worked, then enter it into the sheet. The times are truncated to the nearest 10th of a minute. IOW, 11:12 is 11.2 but so is 11:13 thru 11:17. What I'd like to do is on a control key sequence, pop up a box to enter the starting and ending time, then when <OK is pressed or clicked, or when you hit enter, have it calculate the time to the tenth, and insert it in whatever field the cursor is in at that point. Any help??? Thanks!! Shawn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pop up calculator possible ? | Excel Discussion (Misc queries) | |||
PMT calculator | Excel Discussion (Misc queries) | |||
Calculator | Excel Discussion (Misc queries) | |||
Calculator | Excel Discussion (Misc queries) | |||
calculator | Excel Discussion (Misc queries) |