View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
donbowyer donbowyer is offline
external usenet poster
 
Posts: 107
Default convert date as text to number

Thanks everyone for the responses.
Simply using DateValue did the trick.
--
donwb


"Rick Rothstein (MVP - VB)" wrote:

You can use the DateValue function as shown in the other responses or you
can just return the value from the TextBox wrapped in the CDate function...

ReturnValue = CDate(TextBox1.Text)

However, since you are taking your input as a typed in String value, you may
want to test it with the IsDate function (for either the CDate or DateValue
method of conversion) first to make sure you really have a date-shape String
value.

Rick


"donbowyer" wrote in message
...
I want to subtract one date from another to obtain days between.
The format of the dates is dd/mm/yy
This works fine if both dates are <<numbers.
However, one date comes from a UserForm TextBox and is <<Text.
I have used successfully the "PasteMultiply" by 1 trick to convert text
that
looks like a NUMBER to a true number,
BUT it doesn't seem to work with text that looks like a DATE.
Help please
--
donwb