Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default DateSerial Troubles

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default DateSerial Troubles

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?

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
Troubles Jonas Krogh Excel Discussion (Misc queries) 1 October 22nd 09 11:14 AM
Recreating the DateSerial()/Date() function Conan Kelly Excel Worksheet Functions 1 March 1st 08 04:43 AM
IF troubles JG Excel Worksheet Functions 6 December 24th 06 04:58 AM
Remove Holidays as DateSerial using Case David Excel Programming 3 August 20th 06 02:59 AM
Time/DateSerial Numeric Value Jay Excel Worksheet Functions 4 March 16th 05 03:34 AM


All times are GMT +1. The time now is 08:14 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"