Hi
sorry I've had a lot on with work and study and have not been able to respond until now
this macro puts the values generated by daddylonglegs' formula into cells in column F, assuming your start dates are in columns A and end dates in column B. if you want to use different columns, you may need to adjust the offset values RC[-5] etc in the fomula, is it is comparing values in cells 5 columns to the lef and 4 columns to the left, at present.
Sub calc_hours()
Dim StartRange As Range, Outcell As Range, CalcCell As Range, CopyCell As Range
Set StartRange = Range("A1:A67")
Set Outcell = Range("F1")
For Each CalcCell In StartRange.Cells
Outcell.FormulaR1C1 = "=12*NETWORKDAYS(RC[-5],RC[-4])-12+IF(NETWORKDAYS(RC[-4],RC[-4]),MEDIAN(MOD(RC[-4],1)*24,6,18),18)-MEDIAN(NETWORKDAYS(RC[-5],RC[-5])*MOD(RC[-5],1)*24,6,18)"
Outcell.Value = Outcell.Value
Set Outcell = Outcell.Offset(1, 0)
Next CalcCell
End Sub
Bookmarks