Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time Stamp
Hello,
I have created a time stamp macro. A very simple one liner. 609140048 ActiveCell.Value = Format(Now(), "yymmddhhmm") 060914_0049 ActiveCell.Value = Format(Now(), "yymmdd_hhmm") 609140050 ActiveCell.Value = CStr(Format(Now(), "yymmddhhmm")) These are three different lines I have tried. I want it to be flush left (text) and to have the leading zero and as in the middle one but I don't want the underscore or gap as in the other ones. How can I get the best of both worlds? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time Stamp
Sub test()
With ActiveCell .NumberFormat = "@" .Value = Format(Now(), "yymmddhhmm") End With End Sub RBS "John Pierce" wrote in message oups.com... Hello, I have created a time stamp macro. A very simple one liner. 609140048 ActiveCell.Value = Format(Now(), "yymmddhhmm") 060914_0049 ActiveCell.Value = Format(Now(), "yymmdd_hhmm") 609140050 ActiveCell.Value = CStr(Format(Now(), "yymmddhhmm")) These are three different lines I have tried. I want it to be flush left (text) and to have the leading zero and as in the middle one but I don't want the underscore or gap as in the other ones. How can I get the best of both worlds? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time Stamp
Thanks RB, that looks good, except for one itty-bitty problem.
In Excel 2003 it causes one of those usually-very-helpful but sometimes-annoying error flags - in this case telling me what I already know - that "The number in this cell is formatted as text or is preceded by an apostrophe." Is there anyway to programmatically prevent this, some built-in error-checking. I tried recording the steps involved in opening the message and selecting "Ignore error" but nothing was recorded. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time Stamp
Try:
Sub test() Application.DisplayAlerts = False With ActiveCell .NumberFormat = "@" .Value = Format(Now(), "yymmddhhmm") End With Application.DisplayAlerts = True End Sub RBS "John Pierce" wrote in message oups.com... Thanks RB, that looks good, except for one itty-bitty problem. In Excel 2003 it causes one of those usually-very-helpful but sometimes-annoying error flags - in this case telling me what I already know - that "The number in this cell is formatted as text or is preceded by an apostrophe." Is there anyway to programmatically prevent this, some built-in error-checking. I tried recording the steps involved in opening the message and selecting "Ignore error" but nothing was recorded. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Time Stamp
Nice try but that didn't get it. Perhaps because the error
isn't caused by VBA but is on the spread sheet. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Time Stamp | Excel Worksheet Functions | |||
time stamp | Excel Worksheet Functions | |||
Time Stamp | Excel Discussion (Misc queries) | |||
time stamp a cell that doesn,t change when time stamping another | Excel Programming | |||
Time Stamp | Excel Programming |