Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 65
Default Function weirdness - #VALUE, then #NAME, then working fine??

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart allignment issue in 2007 but in 2003 its working fine Venkatesh Charts and Charting in Excel 0 March 18th 08 12:38 PM
Visual Basic Function works fine in Excell 2003 but not in Excel 2 Roger Excel Discussion (Misc queries) 8 August 1st 07 03:56 AM
Function weirdness - #VALUE, then #NAME, then working fine?? Ed Excel Programming 3 May 23rd 07 03:17 PM
Newly created Get Function is not working when I copied the syntax from a working function CJ Excel Programming 1 January 16th 07 05:28 AM
Macro fine Run fine from Select but not from KB Shortcut? [email protected] Excel Discussion (Misc queries) 8 August 31st 06 02:06 AM


All times are GMT +1. The time now is 02:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"