View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
[email protected] junior@invalid.com is offline
external usenet poster
 
Posts: 5
Default Entering Dates and auto-completing

G'day Tom

That's done the trick - thanks very much for all your assistance.
Much appreciated!

Regards
Dick

On Tue, 24 Feb 2004 22:15:36 -0500, "Tom Ogilvy"
wrote:

It appears that every 4th cell is formatted as date. So change the code to
this:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim dt As Date
If Target.Count 1 Then Exit Sub
On Error GoTo ErrHandler
If Target.Column = 1 Then
If IsNumeric(Target.Value2) Then
dt = DateSerial(Year(Date), Month(Date), Target.Value2)
Application.EnableEvents = False
Target.Value = dt
Target.NumberFormat = "ddmmmyy"
End If
End If
ErrHandler:
Application.EnableEvents = True
End Sub

use the Value2 property for the target rather than value. This should clear
it up.