Excel Date Format Macro

N

nicole3208

Does anyone have or know where I can get a macro that will allow me to enter
a date for example as 112808 then "enter" and have excel format it as
11/28/08? (using a MM/DD/YY format)
 
B

Bernard Liengme

You would need an On_Change worksheet macro but there are other options:
1) after entering a number of values in your 112808 format, select the range
and use Data | TextToColumn to convert to dates -- notes there is an option
for this in the third step when you use Delimited (rather than Fixed Length)
2) enter your numbers in one column (say A) and use a helper column to
convert to dates with =DATE(RIGHT(A1,2)+100,LEFT(A1,2),MID(A1,3,2))
best wishes
 
D

Don Guillett

Here is one I am using for time entered 0820 or 1528, etc
Right click sheet tab>view code>copy/paste>modify to suit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Columns("c")) Is Nothing Then Exit Sub
Application.EnableEvents = False
Target.Value = Format(Target, "00:00")
Target.NumberFormat = "hh:mm"
Application.EnableEvents = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top