I know how to write a formula to cell in a MACRO, but i need to write the output of this formula to the cell
Rng.Offset(0, 1).Formula = "=CONCATENATE(IF(RC[-1]<>"""",RC[-2]& _ MID(CELL(""filename"",RC),FIND(""]"",CELL(""filename"",RC))+1,256),""""),""_"",RC[-1])"
without using
Rng.Offset(0, 1).Copy
Rng.Offset(0, 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False
I always just overwrite the value of the cell with its current value, so for example:
Rng.Offset(0, 1).Formula = "=CONCATENATE(IF(RC[-1]<>"""",RC[-2]& _
MID(CELL(""filename"",RC),FIND(""]"",CELL(""filename"",RC))+1,256),""""),""_"",RC[-1])"
Rng.Offset(0, 1).Value = Rng.Offset(0, 1).Value
This will remove the formula from the cell and simply replace it with the value calculated by the formula.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.