View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Convert Date to number

Just use the Format function on the calendar's Value property.

MsgBox Format(Me.Calendar1.Value, "yymmdd")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"BigPig" wrote in message
...
Hi all,

Question: How do I convert the Date selected from a calendar to
a numerical
date?

Example: I have a user form with a command button that pulls up
a calendar,
and of course the user can select a date and so on. The issue
is that the
form requires a date in a numerical format, ie yymmdd, with no
hash marks
(all together). I know how to put it in the spreadsheet and
convert the
values by separating them and then concatenating them, but I am
stumped on
how to code it to do the same without resorting to putting on a
spreadsheet,
converting, concatenating and so on.

My thought is that there has to be a way to do that via code,
in lieu of
putting the date on a spreadsheet and letting the spreadsheet
do the work.

My thanks to any and all whether or not I can solve my dilemna.