current date

B

bijan

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
 
L

Lars-Åke Aspelin

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
 
B

Bob Phillips

I would just use

=TODAY()-20

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

Shane Devenshire

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top