Input Masks in Excel?

P

PattiP

Does Excel have input masks, similar to Access? I would like the user to
enter a date field but not have to insert the "/" marks. Example: enter
032405 and it would show up as 03/24/05. Thanks!
 
P

PattiP

Is there a way to convert the entry, i.e. 032405, and have it show up in
another cell in date format? Some kind of VB code?
 
B

Bob Phillips

or try this

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:H10")) Is Nothing Then
With Target
.Value = DateSerial(Right(.Value, 2), Left(.Value, Len(.Value) -
4), Mid(.Value, Len(.Value) - 3, 2))
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
 

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

Top