View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Enter day, default month and year

Let's say the entries are in column A. In the worksheet event code area put
the following:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim v As Integer
Set r = Range("A:A")
If Intersect(Target, r) Is Nothing Then Exit Sub
v = Target.Value
Application.EnableEvents = False
Target.Value = DateSerial(2008, 1, v)
Target.NumberFormat = "mmmm dd, yyyy"
Application.EnableEvents = True
End Sub

This is good for the January worksheet. For the February worksheet simply
replace:
Target.Value = DateSerial(2008, 1, v)
with
Target.Value = DateSerial(2008, 2, v)

REMEMBER: the worksheet code area, not a standard module.
--
Gary''s Student - gsnu200752


"Tim Elhatton" wrote:

Hi,
I would like a user to enter just the day in a cell and then display a fixed
month and year.
For example:
user enters 25
Date display will be January 25, 2008
I have a separate worksheet for each month, so 12 worksheets that will
default to corresponding month. They will all be the year 2008.
Thanks for any tips.