Ray.Mason
02-27-2013, 05:46 AM
Hi Guys!
I have a macro that is designed to look into a below function. The function should only pick dates from specified ranges which are same as current date (J1) and start date or following 6 workdays. Also if end date is >= current date then include. However the macro seems to be picking dates including those outside specified range. Can you please help and see if I have set my function correctly?
Function TaskActive(dtStartDate As Date, dtEndDate As Date) As Boolean
If dtStartDate <= Application.WorksheetFunction.WorkDay(Range("J1").Value, 6) Or dtEndDate >= Range("J1").Value Then
TaskActive = True
Else
TaskActive = False
End If
End Function
I have a macro that is designed to look into a below function. The function should only pick dates from specified ranges which are same as current date (J1) and start date or following 6 workdays. Also if end date is >= current date then include. However the macro seems to be picking dates including those outside specified range. Can you please help and see if I have set my function correctly?
Function TaskActive(dtStartDate As Date, dtEndDate As Date) As Boolean
If dtStartDate <= Application.WorksheetFunction.WorkDay(Range("J1").Value, 6) Or dtEndDate >= Range("J1").Value Then
TaskActive = True
Else
TaskActive = False
End If
End Function