Writing Todays Date to an Excel Worksheet

D

dawhyte

Hi All,

I`m looking for a function in excel that will return todays date in a
‘yyyymmdd’ format when a worksheet opens.

This date would be populated on several cells on the worksheet.

I noticed a TODAY() function in excel but not sure if this can be
changed to suit the format I need

Any hints or tips ?

Thanks


Derek
 
P

Paul B

Derek, use =TODAY() and format the cell as custom yyyymmdd
--
Paul B
Always backup your data before trying something new
Using Excel 2000 & 97
Please post any response to the newsgroups so others can benefit from it
** remove news from my email address to reply by email **
 
I

Ian P

simply select the cell with the date,
select 'format'
select 'cells'
select 'custom'
then in the box below 'TYPE:'
enter yyyymmdd

should work ok for you

Cheers
Ian
 
A

anita

It can be done. If you use that function then right click
on the cell and put the format in that you want it. For
example if you choose date format and select the one you
want. You can make it any way you'd like.

Good luck.
 
D

dawhyte

Thanks for that.....

I`ll try this out when I can and I`ll let everyone know the outcome -
I`m sure it'll work...sounds like common sense solution to me.

Thanks again.
 
D

dawhyte

Thanx for the response....

I`m actually doing this now and I`ve realised I need this solution
slightly modified....

The date/time value for the cell needs to be 16 characters long in the
following format

yyyymmddhhmmss(ms)(ms) .. this needs to be created as follows:

The first 8 chars (yyyymmdd) will be todays date "20031007"
and the last 8 chars (hhmmss(ms)(ms)) can be "00000000"

so I need several cells to be populated with the above when the
spreadsheet is opened...

I imagine this would be some VBA code to say:
1. get todays date
2. format it in 'yyyymmdd' format
3. add 8 zero's to the end of no. 2
4. write this to cell xx

So i really just need to find out how to use TODAY() to format to
'yyyymmdd'

Is it best to put this in the worksheet load event ?

Thanks for the help so far.

Derek
 
D

dawhyte

Just to let everyone know...i've managed to solve this now ..... thanks
Paul B... I actually implemented by setting the cell's formatting to
custom (yyyymmddmsmsmsms) and using the TODAY() formula

The 'ms' comes up as '0' so there are 8 zeros after the date.

Thanks

Derek
 
D

dawhyte

Just to let everyone know...i've managed to solve this now ..... thanks
Paul B... I actually implemented by setting the cell's formatting to
custom (yyyymmddmsmsmsms) and using the TODAY() formula

The 'ms' comes up as '0' so there are 8 zeros after the date.

Thanks

Derek
 

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