Thread: Overtime Hours
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Overtime Hours

I have just posted another similar example

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "B:B"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Value 8 Then
.Offset(0, 1).Value = .Value - 8
.Value = 8
End With
End If

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

RP
(remove nothere from the email address if mailing direct)


"Marhanen" wrote in message
...
I am using the same exact format in my spreadsheet that Zack is. I have

gone
to the link you have posted and my head is still swimming from the amount

of
information that is there. I have no idea where to begin and the event

seems
like it would be fairly simple. Any suggestions for an actual example of

the
event?

Thanks - Mar

"Peo Sjoblom" wrote:

You are posting in functions and there is not function that will change

10
to 8, you need an event macro for this, see:

http://www.mvps.org/dmcritchie/excel/event.htm


you could however use 3 cells instead of 2

assume you put 10 in C2, in D2 you can use

=MIN(8,C2)

for regular hours

then for OT in E2 use

=MAX(0,C2-8)

--
Regards,

Peo Sjoblom

(No private emails please)


"Zack" wrote in message
...
no i only have to columns look like this
January Week 1 Overtime
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Total weekly hours 0.00 0.00

i need a formula that if i put a 10 in the reg hours it will become an

8
and
the other 2 hours will go in the overtime column


"Peo Sjoblom" wrote:

http://www.cpearson.com/excel/overtime.htm

--
Regards,

Peo Sjoblom

(No private emails please)


"Zack" wrote in message
...
I am using a time card template and what i want is a forumal that if

i
put
10
hours in the reg hours colum it will automatically change and add

the 2
hours
of overtime in the overtime row is this possible?