change the type of your function. Change
Function AAAAA(TAKT As String, WeekEnds As String, BuildAhead As String,
DueDate As String, Shifts As String, HoursPerDay As String) As Integer
to
Function AAAAA(TAKT As String, WeekEnds As String, BuildAhead As String,
DueDate As String, Shifts As String, HoursPerDay As String) As Long
or
Function AAAAA(TAKT As String, WeekEnds As String, BuildAhead As String,
DueDate As String, Shifts As String, HoursPerDay As String) As Date
--
Regards,
Tom Ogilvy
"rockerx" wrote:
> I have some VB Script that I am writing. To make it simple, I am defining a
> function as follows:
>
> 'The Code
> Function AAAAA(TAKT As String, WeekEnds As String, BuildAhead As String,
> DueDate As String, Shifts As String, HoursPerDay As String) As Integer
>
> Dim iDailyProduction As Integer
> Dim iBuildAheadTime As Integer
> Dim iWeekEndDays As Integer
> Dim StraightStartDate As Date
> Dim t As Integer
> Dim iWeekEndDaysInPeriod As Integer
> Dim iDay As Integer
>
> Select Case UCase(WeekEnds)
> Case "SUN"
> iDay = 1
> Case "SAT"
> iDay = 7
> End Select
>
> iDailyProduction = 3600 * (HoursPerDay - 0.5) / TAKT
> iBuildAheadTime = (BuildAhead / iDailyProduction)
> AAAAA = DateSerial(1989, 5, 15)
>
> End Function
>
> This is not the complete code, I have eliminated some of it for
> troubleshooting purposes.
>
> The problem I am running into is: if I any year less than 1990, the function
> operates coorectly. For any date 1990 or greater, the function returns the
> #VALUE! error in the cell.
>
> Any ideas?
|