LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Need Help Converting Date & Time Stored as Text

This works just fine until I reach a cell with no data, i.e., empty.
Is there a way to modify the code so it will exclude/ignore empty
cells and continue converting the remainder of the column?

Try this...

Dim X As Long
Dim ModifiedDateString As String
For X = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If Len(Range("A" & CStr(X)).Value) 0 Then
ModifiedDateString = Replace(Range("A" & CStr(X)).Value, ":000", " ")
Range("A" & CStr(X)).Value = DateValue(ModifiedDateString) & " " & _
TimeValue(ModifiedDateString)
End If
Next

Rick
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting text format of time/date into Excel time/date for subtr YY san.[_2_] Excel Worksheet Functions 6 February 25th 10 08:27 AM
Help converting text to date & time? Jon M Excel Worksheet Functions 2 February 3rd 09 01:15 PM
Need help converting Number stored as Text to Date LuvHaleiwa Excel Discussion (Misc queries) 4 December 21st 07 08:09 PM
converting general text to date time [email protected] Excel Discussion (Misc queries) 2 May 21st 06 08:26 PM
converting text in cell to a date time Herman Excel Worksheet Functions 3 October 22nd 05 07:18 PM


All times are GMT +1. The time now is 02:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"