ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   current date (https://www.excelbanter.com/excel-discussion-misc-queries/215283-current-date.html)

bijan

current date
 
Hi All
I use Excel 2003 SP2 and have two question:
1. I try to set function "=year(date())" in control source property of a
textbox but I recive an error to use invalid property why?

2. I need get current date and minus 20 days and show it in a textbox with
this formt 04-JAN-2009?

Thanks in advance
Bijan

Lars-Åke Aspelin[_2_]

current date
 
On Sun, 4 Jan 2009 08:17:01 -0800, bijan
wrote:

Hi All
I use Excel 2003 SP2 and have two question:
1. I try to set function "=year(date())" in control source property of a
textbox but I recive an error to use invalid property why?

2. I need get current date and minus 20 days and show it in a textbox with
this formt 04-JAN-2009?

Thanks in advance
Bijan



Try this formula in the linked cell:

=TEXT(TODAY()-20,"DD-MMM-YYYY")

Hope this helps / Lars-Åke

Bob Phillips[_3_]

current date
 
I would just use

=TODAY()-20

and format the cell as required so as to leave a true date in the cell.

--
__________________________________
HTH

Bob

"Lars-Åke Aspelin" wrote in message
...
On Sun, 4 Jan 2009 08:17:01 -0800, bijan
wrote:

Hi All
I use Excel 2003 SP2 and have two question:
1. I try to set function "=year(date())" in control source property of a
textbox but I recive an error to use invalid property why?

2. I need get current date and minus 20 days and show it in a textbox with
this formt 04-JAN-2009?

Thanks in advance
Bijan



Try this formula in the linked cell:

=TEXT(TODAY()-20,"DD-MMM-YYYY")

Hope this helps / Lars-Åke




Bob Phillips[_3_]

current date
 
Oops, missed the textbox point.

--
__________________________________
HTH

Bob

"Bob Phillips" wrote in message
...
I would just use

=TODAY()-20

and format the cell as required so as to leave a true date in the cell.

--
__________________________________
HTH

Bob

"Lars-Åke Aspelin" wrote in message
...
On Sun, 4 Jan 2009 08:17:01 -0800, bijan
wrote:

Hi All
I use Excel 2003 SP2 and have two question:
1. I try to set function "=year(date())" in control source property of a
textbox but I recive an error to use invalid property why?

2. I need get current date and minus 20 days and show it in a textbox
with
this formt 04-JAN-2009?

Thanks in advance
Bijan



Try this formula in the linked cell:

=TEXT(TODAY()-20,"DD-MMM-YYYY")

Hope this helps / Lars-Åke






Shane Devenshire[_2_]

current date
 
Hi,

You haven't told us where your text box is - is it in the spreadsheet or on
a VBA form.

Suppose it's on a user form (VBA) then

Private Sub UserForm_Initialize()
Me.TextBox1 = Format(Date-20, "dd-mmm-yyyy")
End Sub


--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"bijan" wrote:

Hi All
I use Excel 2003 SP2 and have two question:
1. I try to set function "=year(date())" in control source property of a
textbox but I recive an error to use invalid property why?

2. I need get current date and minus 20 days and show it in a textbox with
this formt 04-JAN-2009?

Thanks in advance
Bijan



All times are GMT +1. The time now is 08:55 PM.

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