Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngMonitor As Range, rngMonthEntry As Range, rngCell As Range
Dim lngCol As Long
Dim dteEntry As Date
On Error Resume Next
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set rngMonitor = Range("B1:D1")
Set rngMonthEntry = Intersect(Target, rngMonitor)
If Not rngMonthEntry Is Nothing Then
lngCol = rngMonthEntry.Column - rngMonitor.Column
dteEntry = DateAdd("m", -lngCol, DateValue("1-" & rngMonthEntry.Value & "-2009"))
For Each rngCell In rngMonitor
' rngCell.Value = Format(dteEntry, "mmmm")
rngCell.Value = Format(dteEntry, "dd mmm yyyy")
dteEntry = DateAdd("m", 1, dteEntry)
Next rngCell
End If
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
|