Date (1 Viewer)

bgcogen

Registered User.
Local time
Today, 06:57
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
 

boblarson

Smeghead
Local time
Yesterday, 22:57
Joined
Jan 12, 2001
Messages
32,059
Are you doing this in Excel or Access?

BL
 

Users who are viewing this thread

Top Bottom