1

I have a vba statement

fnb = "=RIGHT(t4,LEN(t4)-SEARCH(""_"",t4))"

This renders the appropriate Value when I assign the results to a cell, but I want to use the variable value within another equation. I'm trying to use the variable fnb:

ActiveCell.FormulaR1C1 = _
           "=IF(COUNTIF(R[-1]C,""*Final*""),""RW_""&R7C20&R7C21&""_Final"",""RW_""&R7C20&R7C21&""_v""" & fnb & ")"

but when I execute it I get the value of fnb within the cell as the equation itself:

=RIGHT(t4,LEN(t4)-SEARCH(""_"",t4))

How do I phrase the statement to use the VALUE of the string instead of the equation?

Barry
  • 11
  • 1
  • 2
    You might want to try `EVALUATE`. Check out https://stackoverflow.com/questions/28767103/vba-evaluate-function-with-string-arguments. – bugdrown Dec 19 '21 at 01:24

0 Answers0