Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
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.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default 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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort month/date/year data using month and date only SMW820 Excel Discussion (Misc queries) 6 June 22nd 06 05:14 PM
trying to get day/month/year froamt while user enters year only RADIOOZ New Users to Excel 3 June 7th 06 05:30 AM
How to use month() and day() without considering year()? Eric Excel Worksheet Functions 5 February 7th 06 03:09 PM
How to use month() and day() without considering year()? Eric Excel Discussion (Misc queries) 1 February 3rd 06 02:37 PM
Sum by month and year Steven Robilard Excel Discussion (Misc queries) 2 May 10th 05 03:22 PM


All times are GMT +1. The time now is 12:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"