Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On May 23, 7:17 am, Barb Reinhardt
wrote: Can you show the function? Barb: I'm pretty rough in coding! I hope this doesn't give you nightmares! The basic idea is to count the number of days (WorkdaysLater) from the start date (OrderDate), counting only Monday through Thursday and not holidays. Holidays are set and come up in strDates. Ed Public Function DueDate(OrderDate As Date, WorkdaysLater As Integer) As Date Dim iCt As Integer Dim iCt2 As Integer Dim x As Integer Dim strDates As String Dim strDay As String 'Stop strDates = ActiveSheet.Range("IN14").Text strDates = strDates & ActiveSheet.Range("IP14").Text iCt = 0 iCt2 = 0 x = WorkdaysLater If x 1 Then Do iCt = iCt + 1 If Weekday(OrderDate + iCt) 1 And _ Weekday(OrderDate + iCt) < 6 Then strDay = OrderDate + iCt If InStr(1, strDates, strDay, vbTextCompare) = 0 Then iCt2 = iCt2 + 1 End If End If Loop Until iCt2 = x - 1 Else Do iCt = iCt + 1 If Weekday(OrderDate + iCt) 1 And _ Weekday(OrderDate + iCt) < 6 Then strDay = OrderDate + iCt If InStr(1, strDates, strDay, vbTextCompare) = 0 Then iCt2 = iCt2 + 1 End If End If Loop Until iCt2 = x End If DueDate = Format(OrderDate + iCt, "mm/dd/yy") End Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Chart allignment issue in 2007 but in 2003 its working fine | Charts and Charting in Excel | |||
Visual Basic Function works fine in Excell 2003 but not in Excel 2 | Excel Discussion (Misc queries) | |||
Function weirdness - #VALUE, then #NAME, then working fine?? | Excel Programming | |||
Newly created Get Function is not working when I copied the syntax from a working function | Excel Programming | |||
Macro fine Run fine from Select but not from KB Shortcut? | Excel Discussion (Misc queries) |