Hello,
I have a macro where I want to replace all empty cells in a range with a formula. Here is the code that I have currently:
ThisWorkbook.Worksheets("Exhibit").Range("K14:K63").Replace What:="", Replacement:="=IF(G14="""","""",vlookup(""SomeValue"", SomeTab!$A$1:$B$200, 2, false))"
However, this replacement method removes the relative cell referencing. I need "G14" in the IF statement to update to whichever row the empty cell is in. For example, if the empty cell is K20, I need the replacement formula to be this:
=IF(G20="""","""",vlookup(""SomeValue"", SomeTab!$A$1:$B$200, 2, false))
Cheers!
Bookmarks