ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   find current data with macro (https://www.excelbanter.com/excel-discussion-misc-queries/201433-find-current-data-macro.html)

Francesco Magagnino

find current data with macro
 
Hi,
i'm looking for the macro code to find out the current date and have
it in this format 20080905 (yyyymmdd)

it's should be easy but i don't find anything about it

please can anyone help me

thanks
francesco

Mike H

find current data with macro
 
Try

Range("A1").Value = Format(Date, "yyyymmdd")

Mike

"Francesco Magagnino" wrote:

Hi,
i'm looking for the macro code to find out the current date and have
it in this format 20080905 (yyyymmdd)

it's should be easy but i don't find anything about it

please can anyone help me

thanks
francesco


Francesco Magagnino

find current data with macro
 
Tnhanks!
i had tried this and it didn't work...
now i have understand!

i used:

Dim y As Date
y = Format(Date, "yyyymmdd")

but the right one was

Dim y As String
y = Format(Date, "yyyymmdd")

Bye bye
Franz

Range("A1").Value = Format(Date, "yyyymmdd")




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

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