Displaying Date in Textbox?

A

Alan T

How do I display the current date in a Textbox?

I've tried to link it to a cell but end up it expressed in numerica
format eg 37956.6999259259. I'd like it to be displayed in either o
the following formats dd/mm/yy or dd/mmm/yyyy
 
B

Bob Phillips

Alan,

What you are seeing is the value that Excel stores for a date, which is a
serial number. When you see say '01 Dec 2003' on a worksheet, the only
reason you are not seeing 37,956 is because it is formatted as a date.

So, you need to format the textbox, something like

Textbox1.Text = Format(Worksheets(1).Range("A1"),"dd mmm yyyy")

changing the references and format to suit of course.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Alan T said:
How do I display the current date in a Textbox?

I've tried to link it to a cell but end up it expressed in numerical
format eg 37956.6999259259. I'd like it to be displayed in either of
the following formats dd/mm/yy or dd/mmm/yyyy.
creating financial statements
 
M

MS

=Now()

then format the cell to what you require dd/mm/yy or dd/mmm/yyyy.


--
----------------------------------------------------------------------------
http://www.clickonlingerie.com?SIG - Exotic Erotic Lingerie
----------------------------------------------------------------------------


Alan T said:
How do I display the current date in a Textbox?

I've tried to link it to a cell but end up it expressed in numerical
format eg 37956.6999259259. I'd like it to be displayed in either of
the following formats dd/mm/yy or dd/mmm/yyyy.
creating financial statements
 
Top