Convert date to serial number in VBA

  • Thread starter Thread starter Michael J. Malinsky
  • Start date Start date
M

Michael J. Malinsky

I have a couple of dates that are input via UserForm and are then used in
VBA calculations. Something like EndDate-BeginDate+1 gives the number of
days (so January 31, 2003 minus January 1, 2003 results in 31 days). Due to
calculations elsewhere in my code, this doesn't seem to be doing the trick.
What I'd like to do within VBA is covert the dates to serial numbers so
September 10, 2003 would be converted to 37874 before any calculations are
performed. I've look high and low and can't find help on the boards or in
the knowledge base or in help. Either its not there or I fried my brain.

TIA.
Mike.
 
Michael,

Take a look at how you input the date in the form. The output of a textbox
is text and has to be reconverted to numeric.
Try something like
myvar = Val(MyForm.TextBox1.Value)
 
Back
Top