Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to enter a number in a cell (any value) and end up with a max. of 8 in
that cell. The remainder to be tranfered to another. This to create a time-sheet where the normal and overtime hours are automatically separated |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I assume cells are formatted as time and hours are entered as 8:00. This is an event code and has to be pasted into the code sheet for the desired sheet. In this example hours are entered in B2:B10 and overtime are transfered to C2:C10. Private Sub Worksheet_Change(ByVal Target As Range) Dim TargetRange As Range Set TargetRange = Range("B2:B10") ' Change to suit Set isect = Intersect(Target, TargetRange) If Not isect Is Nothing Then If Target.Value TimeValue("08:00:00") Then mytime = Target.Value Target.Value = TimeValue("08:00:00") Target.Offset(0, 1) = mytime - TimeValue("08:00:00") End If End If End Sub Best regards, Per "Harberg" skrev i meddelelsen ... I want to enter a number in a cell (any value) and end up with a max. of 8 in that cell. The remainder to be tranfered to another. This to create a time-sheet where the normal and overtime hours are automatically separated |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I assume cells are formatted as time and hours are entered as 8:00. This is an event code and has to be pasted into the code sheet for the desired sheet. In this example hours are entered in B2:B10 and overtime are transfered to C2:C10. Private Sub Worksheet_Change(ByVal Target As Range) Dim TargetRange As Range Set TargetRange = Range("B2:B10") ' Change to suit Set isect = Intersect(Target, TargetRange) If Not isect Is Nothing Then If Target.Value TimeValue("08:00:00") Then mytime = Target.Value Target.Value = TimeValue("08:00:00") Target.Offset(0, 1) = mytime - TimeValue("08:00:00") End If End If End Sub Best regards, Per "Harberg" skrev i meddelelsen ... I want to enter a number in a cell (any value) and end up with a max. of 8 in that cell. The remainder to be tranfered to another. This to create a time-sheet where the normal and overtime hours are automatically separated |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do you make one cell larger than all the rest | Excel Discussion (Misc queries) | |||
how to keep the first initial of a name &delete the rest in cell | Excel Discussion (Misc queries) | |||
Addind cell together with a rest. | Excel Discussion (Misc queries) | |||
VBA code to fill rest of cell with dashes (-) | Excel Programming | |||
Based on one cell criteria to change the rest of that row to a col | Excel Discussion (Misc queries) |