ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Autocomplete -Date (https://www.excelbanter.com/excel-discussion-misc-queries/249705-autocomplete-date.html)

John Keith

Autocomplete -Date
 
If I enter the following date on today (Nov 30, 2009) 2/15 the date
that is entered is 2/15/2009. Is there anyway to get Excel to default
to entering 2/15/2010, in other words not complete the date with the
current calendar year but rather select the year of the next occurence
of the MM/DD?


John Keith


Stefi

Autocomplete -Date
 
You can either enter this formula in a separate cell:

=DATE(YEAR(A1)+(A1<TODAY()),MONTH(A1),DAY(A1))

or install this change event sub if you want the result in the input cell:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address(False, False) = "A1" Then _
Target = DateSerial(Year(Target) - (Target < Date), Month(Target),
Day(Target))
Application.EnableEvents = True
End Sub

Post if you need help to install it!
Regards,
Stefi


€˛John Keith€¯ ezt Ć*rta:

If I enter the following date on today (Nov 30, 2009) 2/15 the date
that is entered is 2/15/2009. Is there anyway to get Excel to default
to entering 2/15/2010, in other words not complete the date with the
current calendar year but rather select the year of the next occurence
of the MM/DD?


John Keith

.


John Keith

Autocomplete -Date
 
Stefi,

Thank you for the sugestions.

What would have been ideal for my situation would be a option
configuration switch but obviously that does not exist :-(

On Tue, 1 Dec 2009 00:11:01 -0800, Stefi
wrote:

You can either enter this formula in a separate cell:

=DATE(YEAR(A1)+(A1<TODAY()),MONTH(A1),DAY(A1))

or install this change event sub if you want the result in the input cell:




John Keith


Stefi

Autocomplete -Date
 
You are welcome! Thanks for the feedback!
This is really a specific job, you cannot expect a solution ready to use.
Clicking the YES button will be appreciated.


--
Regards!
Stefi



€˛John Keith€¯ ezt Ć*rta:

Stefi,

Thank you for the sugestions.

What would have been ideal for my situation would be a option
configuration switch but obviously that does not exist :-(

On Tue, 1 Dec 2009 00:11:01 -0800, Stefi
wrote:

You can either enter this formula in a separate cell:

=DATE(YEAR(A1)+(A1<TODAY()),MONTH(A1),DAY(A1))

or install this change event sub if you want the result in the input cell:




John Keith

.



All times are GMT +1. The time now is 02:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com