ALLAROUNDOFFICE
Board Regular
- Joined
- Apr 26, 2014
- Messages
- 61
How can I hard code a column of cells to convert the user entered data of "042614" or "42614" into a specific date format such as 04/26/2014?
You can do this conversion automatically using the following event code. Assuming your column is Column A...How can I hard code a column of cells to convert the user entered data of "042614" or "42614" into a specific date format such as 04/26/2014?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
On Error GoTo NothingInColumn
If Not Intersect(Target, Columns("[COLOR=#FF0000][B]A[/B][/COLOR]")) Is Nothing Then
For Each Cell In Intersect(Target, Intersect(Columns("[COLOR=#FF0000][B]A[/B][/COLOR]"), ActiveSheet.UsedRange))
If Not IsDate(Cell.Value) And Not Cell.Value Like "*[!0-9]*" Then
Cell.Value = Format(Cell.Value, "0/00/00")
End If
Next
End If
NothingInColumn:
End Sub
Did you copy/paste it or type it in? I copy/pasted it and it worked fine for me.I entered the formula from sheetspread, but Excel came back and said that I entered too many functions for this argument??? Any other ideas?
Yes, I copy and pasted it. Just tried again and Excel is coming back with same error...I'm just entering this formula in a cell. Do I need to do something else?
The date field starts in A3 and I am trying to insert the formula in A3. Should I replace all of the A1's in the formula with A3's?