Incriment value of cells in target row

Timmo7410

New Member
Joined
Nov 30, 2013
Messages
13
Hi all,

I have the following code that might be a bit rough, but runs. The purpose of this part of the macro is call a conditional formatting subroutine and to then find the difference in value between two dates.
What I can't do is add 1 to the difference in the dates.
The point of it all is for a 'time in leiu tracking spreadsheet', therefore if someone takes only one day off, they enter the same date twice and the value is 0 when is should be 1 (for one day) and so on.
Any input would be great, I think my issue is trying to peform math functions within VBA on date values. Eitherway, its done my head in.

----------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Not Application.Intersect(Target, Range("D16:D100", "E16:E100")) Is Nothing Then
Call DateCheck
End If
If IsEmpty(Cells(Target.Row, "D")) = False And IsEmpty(Cells(Target.Row, "E")) = False Then
If Cells(Target.Row, "E") > Cells(Target.Row, "D") Then
Cells(Target.Row, "F") = Cells(Target.Row, "E") - Cells(Target.Row, "D")
End If
End If
End Sub
---------------------------
Cheers,
Tim.
 

Some videos you may like

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Watch MrExcel Video

Forum statistics

Threads
1,099,787
Messages
5,470,780
Members
406,720
Latest member
tylergaps

This Week's Hot Topics

Top