View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
isabelle isabelle is offline
external usenet poster
 
Posts: 99
Default Convert date/time to serial number and compare serial numbers

if you don't want the formula but only the value

With Range("B1")
..Value = DateSerial(Left(Cells(1, 1), 4), Mid(Cells(1, 1), 6, 2), Mid(Cells(1,
1), 9, 2)) + CDate(Right(Cells(1, 1), 8))
..NumberFormat = "General"
'or
'.NumberFormat = "yyyy/mm/dd hh:mm:ss"
End With

isabelle

Le 2016-11-04 Ã* 11:51, isabelle a écrit :
also,

With Range("B1")
.Formula = "=DATE(LEFT(A1,4),MID(A1,6,2),MID(A1,9,2))+RIGHT(A 1,8)"
.NumberFormat = "General"
'or
'.NumberFormat = "yyyy/mm/dd hh:mm:ss"
End With

isabelle

Le 2016-11-04 Ã* 10:59, GARYWC a écrit :
The cells have a text format.