I have the following vba code to specify days from an EndDate. How do I specify a target row for it to automatically insert when the EndDate is inserted? The EndDate will be in column D and the days will be in column E. Thanks
Function GetWorkDays(StartDate As Long, EndDate As Long) As Long
' returns the count of days between StartDate - EndDate minus Saturdays and Sundays
Dim d As Long, dCount As Long
For d = StartDate To EndDate
If WeekDay(d, vbMonday) < 6 Then
dCount = dCount + 1
End If
Next d
GetWorkDays = dCount
End Function
Bookmarks