I am trying to format a column in excel sheet where regular format datetime to date option is not working as I exported data in excel from clear quest. I need date column in mm/dd/yyyy format bis there a VB script that can do this.
Asked
Active
Viewed 112 times
-2
-
duplicate: http://stackoverflow.com/q/19801598/119775 – Jean-François Corbett Apr 19 '15 at 20:18
2 Answers
0
Sub DateFormat()
Range("C2:C64").NumberFormat = "mm/dd/yyyy"
End Sub

Three-D
- 75
- 1
- 8
-
-
@user803860 - Change "Columns("G:G").Select" to "Range("C2:C64").Select" – Three-D Apr 08 '15 at 15:06
-
Sub DateFormat() ' 'Change G:G to the column(s) you would like to change ' Columns("C2:C64").Select Selection.NumberFormat = "mm/dd/yyyy" Range("C2").Select End Sub – user803860 Apr 08 '15 at 17:49
-
@user803860 - you have to change "Columns" to "Range".......or, just use the new code after I did the edit to my answer. – Three-D Apr 08 '15 at 19:01
-
@user803860 - did this do what you needed? if so, please mark as answered. if not, please let me know what you are seeing. thanks :) – Three-D Apr 09 '15 at 12:21
-
That didn't work seems like when you export from clear quest it doesn't let u format – user803860 Apr 09 '15 at 13:04
0
Based on this post: Excel VBA date formats
Function CellContentCanBeInterpretedAsADate(cell As Range) As Boolean
Dim d As Date
On Error Resume Next
d = CDate(cell.Value)
If Err.Number <> 0 Then
CellContentCanBeInterpretedAsADate = False
Else
CellContentCanBeInterpretedAsADate = True
End If
On Error GoTo 0
End Function

Community
- 1
- 1

Hugues Paquet Blanchette
- 612
- 3
- 11
- 24