Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
Cell A1 = blank
Cell A2 is =CONCATENATE(RIGHT(YEAR(NOW()),2),TEXT(MONTH(NOW() ),00),TEXT(DAY(NOW()),00),TEXT(HOUR(NO W()),00),TEXT(MINUTE(NOW()),00),TEXT(S ECOND(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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro
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(NO W()),00),TEXT(MINUTE(NOW()),00),TEXT(S ECOND(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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor | Excel Programming | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |