Unique ID using date & time

jts2004

Board Regular
Joined
Apr 21, 2004
Messages
156
I have a file save as macro that looks at a value in a cell that I create. I want that value to be YEARMONTHDAY MINUTES.

EX: 20051220 719 which means 12/20/2005 11:59AM

the problem in using the now() function is that you can't use "/" or ":" when saving a file. so the cell value has to equal "20051220 719" in order for the macro to save the file.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Assuming your date and time is in A1 on Sheet1:

Code:
Sub Test()
    With Worksheets("Sheet1").Range("A1")
        MsgBox Format(.Value, "yyyymmdd") & " " & WorksheetFunction.Round((.Value - Int(.Value)) * 1440, 0)
    End With
End Sub
 
Upvote 0
Re: THANKS

jts2004 said:
Any way to do it with a formula in A1

A formula in A1 referring to what? If the date and time were in B1:

=TEXT(B1,"yyyymmdd")&" "&ROUND((B1-INT(B1))*1440,0)
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,031
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top