ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pop-up calculator? (https://www.excelbanter.com/excel-programming/304622-pop-up-calculator.html)

43fan

Pop-up calculator?
 
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



Bob Phillips[_6_]

Pop-up calculator?
 


--

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





Bob Phillips[_6_]

Pop-up calculator?
 
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





43fan

Pop-up calculator?
 
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







Bob Phillips[_6_]

Pop-up calculator?
 
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










All times are GMT +1. The time now is 03:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com