Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I get an excel sheet that has the date format like this:
8/9/04 1:25:43 PM EDT How whould I set up a macro that would delet all that data after the year number? can this be done? THnanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() For Each cell In Selection If IsDate(cell.Value) Then cell.Value = Int(cell.Value) cell.NumberFormat = "m/d/yy" End If Next cell -- HTH RP (remove nothere from the email address if mailing direct) "KAnoe" wrote in message ... I get an excel sheet that has the date format like this: 8/9/04 1:25:43 PM EDT How whould I set up a macro that would delet all that data after the year number? can this be done? THnanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob,
How would I use this code? Would I put it in a Macro? "Bob Phillips" wrote: For Each cell In Selection If IsDate(cell.Value) Then cell.Value = Int(cell.Value) cell.NumberFormat = "m/d/yy" End If Next cell -- HTH RP (remove nothere from the email address if mailing direct) "KAnoe" wrote in message ... I get an excel sheet that has the date format like this: 8/9/04 1:25:43 PM EDT How whould I set up a macro that would delet all that data after the year number? can this be done? THnanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, Bob:
His data is 8/9/04 1:25:43 PM EDT The final "EDT" means that neither Excel or VB recognize it as a date. Maybe this will work For Each cell In Selection With Cell X = .Value i = Instr(X, " ") If i 0 Then .Value = CDate(Left$(X, i - 1)) .NumberFormat = "m/d/yy" End If End With Next cell On Sat, 6 Nov 2004 00:56:16 -0000, "Bob Phillips" wrote: For Each cell In Selection If IsDate(cell.Value) Then cell.Value = Int(cell.Value) cell.NumberFormat = "m/d/yy" End If Next cell |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to delete rows based on date | Excel Discussion (Misc queries) | |||
Macro to delete rows with same data | Excel Worksheet Functions | |||
Macro to delete certain data | Excel Worksheet Functions | |||
macro to find date format in a cell and delete that entire row | Excel Programming | |||
Macro want delete the date row? | Excel Programming |