Date

bgcogen

Registered User.
Local time
Today, 19:10
Joined
Apr 19, 2002
Messages
61
Hi.
I have this code that is supposed to convert my Date's in string format to date format. This is because when I copy and paste from Access to Excel, dates are screwed up :-(

Right now this macro only converts the first cell. How can I modify the code to convert all the elements in the list??

Sub DateTextToDate()
' Converts all text-formatted cells that contain legitimate
' date strings to Excel dates
Dim Cell As Range
Dim strDate As String
For Each Cell In ActiveSheet.UsedRange
If IsDate(Cell) Then
strDate = Cell
Cell.ClearContents
Cell.NumberFormat = "General"
Cell = strDate
End If
Next Cell
End Sub


Thanks for any help
:-)

Declan
 

Users who are viewing this thread

Back
Top Bottom