D
David Sisson
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
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