![]() |
Enter day, default month and year
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. |
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. |
Enter day, default month and year
If your 25 is in A1, use the formula =DATE(2008,1,A1)
-- David Biddulph "Tim Elhatton" wrote in message ... 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. |
All times are GMT +1. The time now is 01:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com