View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Convert Date/time to date only in vba

Jonathan,
Date/time is stored as a double in Excel; the whole number part is the date
and the fractional part is the time. So if you remove the decimal part, you
have a date only - or rather a midnight on that day.

=INT(A1)

NickHK

"Jonathan" wrote in message
...
Hi,

I have a dataset I extract from another tool and import into Excel. The
dates from this toolset are in dd/mm/yyyy hrs/min/sec format, I need to
programmatically change this to be just dd/mm/yyyy format in the columns
containing the dates. I've tried looping through and using datevalue() and
just trimming the contents to only the first 10 characters but neither

work
for me, can anyone send me a snippet of code to get the job done?

Regards

Jonathan