#1   Report Post  
Jim May
 
Posts: n/a
Default Where's the bug?

with 3/15/04 (formated date) in Cell B5
and =Spdate(B5) in D5 -- results -- #VALUE! 'Help

Function SpDate(MyDate As Date) As String
Dim MYr As String
Dim MWk As String
Dim MDy As String
MYr = Year(MyDate)
MWk = Round((MyDate - DateSerial(Year(MyDate), 1, 1)) / 7, 0)
MDy = Day(MyDate)
SpDate = "MYr&" / "&MWk&" / "&MDy"
End Function


  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

You are treating it like worksheet functions Jim.

The last line should not be in quotes

Function SpDate(MyDate As Date) As String
Dim MYr As String
Dim MWk As String
Dim MDy As String
MYr = Year(MyDate)
MWk = Round((MyDate - DateSerial(Year(MyDate), 1, 1)) / 7, 0)
MDy = Day(MyDate)
SpDate = MYr & " / " & MWk & " / " & MDy
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim May" wrote in message
news:JkImd.1120$wC.939@lakeread08...
with 3/15/04 (formated date) in Cell B5
and =Spdate(B5) in D5 -- results -- #VALUE! 'Help

Function SpDate(MyDate As Date) As String
Dim MYr As String
Dim MWk As String
Dim MDy As String
MYr = Year(MyDate)
MWk = Round((MyDate - DateSerial(Year(MyDate), 1, 1)) / 7, 0)
MDy = Day(MyDate)
SpDate = "MYr&" / "&MWk&" / "&MDy"
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



All times are GMT +1. The time now is 07:33 AM.

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

About Us

"It's about Microsoft Excel"