From: GEdwards on
Cell A1 = blank
Cell A2 is …
=CONCATENATE(RIGHT(YEAR(NOW()),2),TEXT(MONTH(NOW()),”00”),TEXT(DAY(NOW()),”00”),TEXT(HOUR(NOW()),”00”),TEXT(MINUTE(NOW()),”00”),TEXT(SECOND(NOW()),”00”))

(results in yymmddhhmmss)

I need a macro or something that when A1 = blank, then I want the resulting
value from A2 to be put into A1. I DO NOT want the formula copied from A2.

What do I need to do to get the resulting value from A2 into A1?
From: OssieMac on
Hi,

To insert the following code, right click the worksheet tab name, select
View Code and then copy the code below and paste it into the VBA editor.
Close the editor by clicking the X with red background top right of VBA
editor screen.

The code will test A1 each time the worksheet recalculates but will only
update A1 if it is blank.


Private Sub Worksheet_Calculate()

If IsEmpty(Range("A1")) Then
Range("A1") = Range("A2")
End If

End Sub


Also your formula can be modified to a much simpler one.

=TEXT(NOW(),"yymmddhhmmss")

--
Regards,

OssieMac


"GEdwards" wrote:

> Cell A1 = blank
> Cell A2 is …
> =CONCATENATE(RIGHT(YEAR(NOW()),2),TEXT(MONTH(NOW()),”00”),TEXT(DAY(NOW()),”00”),TEXT(HOUR(NOW()),”00”),TEXT(MINUTE(NOW()),”00”),TEXT(SECOND(NOW()),”00”))
>
> (results in yymmddhhmmss)
>
> I need a macro or something that when A1 = blank, then I want the resulting
> value from A2 to be put into A1. I DO NOT want the formula copied from A2.
>
> What do I need to do to get the resulting value from A2 into A1?