VB Format command fails
Hi Kirk,
Format function reutrns a string value not a date value and hense cannot be
assigned to a date variable.
00/11/75 is not a valid date and you can't even use DateValue to return a
date from it.
You can use Val but it will return zero.
What are you trying to achieve? There may be another way.
--
Regards,
OssieMac
"kirkm" wrote:
Hi,
Anyone know what's wrong here?
Cell(1,1) contains "00/11/1975" as text.
Dim v as Date
v = Format(.Cells(1, 1), "mmm yyyy")
If v is dimmed as a Variant the format is unchanged
and in the above example returns 'type mismatch'.
Have spend a long time trying all sorts of variations
without success.
Thanks - Kirk
|