LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Date not formatting properly

I have this function:

Function Qtr2Date(QtrDate As String, TimeLimit As Long) As Date
'Change "1Q06" to a date + 1

Dim LtrPos As Long
Dim QtrMonth As Long
Dim QtrYear As String
Dim YrPlusTerm As Long

LtrPos = InStr(UCase(QtrDate), "Q")
QtrMonth = Left(QtrDate, LtrPos - 1)
QtrYear = Mid(QtrDate, Len(QtrDate) - LtrPos + 1, 2)
YrPlusTerm = Abs(QtrYear) + TimeLimit

Select Case QtrMonth
Case 1
Qtr2Date = Format("4/1/" + Str(Right(YrPlusTerm, 2)), "mm/dd/yy")

Case 2
Qtr2Date = Format("7/1/" + Str(Right(YrPlusTerm, 2)), "mm/dd/yy")

Case 3
Qtr2Date = Format("10/1/" + Str(Right(YrPlusTerm, 2)), "mm/dd/yy")

Case 4
Qtr2Date = Format("12/31/" + Str(Right(YrPlusTerm, 2)), "mm/dd/yy")
End Select


End Function

It returns the date serial number, not the formatted date.

The column has mixed data, so I can't format the whole column as a
date.

What am I missing?

Thanks,
David

 
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
conditional formatting for cell date to equal today's date Sistereinstein Excel Worksheet Functions 2 September 10th 12 07:53 PM
condtional formatting in office 2007 is not working properly Ashish Parekh Excel Discussion (Misc queries) 1 January 30th 09 03:39 PM
XL 2007: Conditional formatting not saved properly Pere Pete Excel Discussion (Misc queries) 0 August 17th 07 02:05 AM
the auto date feature is not functioning properly - how to reset E. Ruth Cummins New Users to Excel 3 November 15th 05 02:31 AM
Trendline formatting doesn't print or preview properly!? Graham Wideman Charts and Charting in Excel 4 March 4th 05 11:44 PM


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