![]() |
Convert Date to number
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. |
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. |
Convert Date to number
Chip,
Thanks for the advice! Just what I needed. |
All times are GMT +1. The time now is 11:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com