Hi, I need redefine variable type from DATE to STRING and vice versa. Can you get me help please?
Thank a lot
Obivan
Hi, I need redefine variable type from DATE to STRING and vice versa. Can you get me help please?
Thank a lot
Obivan
Obivan,
If you declare a variable as type variant, you can load a date into it at one instance, a text string at anotehr. VBA will automatically sub-type it for you. I don't promote this approach, but it can be done.
BTW, I have moved this to the main Excel forum.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Hi XLD, thank you for your help
obivan
Not sure why you would need to do that. It is best to use one type. You can use the convert functions like CDATE() and CSTR(). Type CDATE in the VBE and press F1 to get help.
You might also try VARTYPE(), ISDATE() and FORMAT().