![]() |
Remove time from date
Is there a macro that can remove the time from the date. I tried
formating the cell and it remove time from the cell. However if you select the cell the time remains. 3/20/2009 8:10:40 PM |
Remove time from date
You just need the mod function to get the fractional part of the time. Use
this =Mod(A1,1) Format the results in any time format you choose. "Little Penny" wrote: Is there a macro that can remove the time from the date. I tried formating the cell and it remove time from the cell. However if you select the cell the time remains. 3/20/2009 8:10:40 PM |
Remove time from date
If you mean you removed the time portion and it still displayed 12:00:00 AM,
that is correct...the date/time at 0 hours, 0 minutes, 0 seconds into the day is exactly midnight. DateValue will strip off the time or, to put it another way, convert the time to exactly midnight. Dim dt As Date dt = Now() MsgBox DateValue(dt) Use a function to get the date-only portion of a date(time). Use formatting to display the results without the time, e.g. "m/d/yy". -- Tim Zych http://www.higherdata.com Workbook Compare - Excel data comparison utility Free and Pro versions "Little Penny" wrote in message ... Is there a macro that can remove the time from the date. I tried formating the cell and it remove time from the cell. However if you select the cell the time remains. 3/20/2009 8:10:40 PM |
Remove time from date
The below code will extract the date part from Column A and write to Column
B. Please try... If this post helps click Yes -------------- Jacob Skaria Dim intRow intRow = 1 Do While Range("A" & intRow) < "" Range("B" & intRow) = Format(Range("A" & intRow), "dd-mm-yyyy") intRow = intRow + 1 Loop |
All times are GMT +1. The time now is 12:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com