Replace Last occurrence of a character
<p>I have a spreadsheet with lots of paths to files in them. I use the following formula to replace the last occurrence of a "\" in each cell of a column. How can I change this to a macro so I don't have to paste in and drag down each column. </p>

<pre><code>=SUBSTITUTE(K2,"\","?",LEN(K2)-LEN(SUBSTITUTE(K2,"\","")))
</code></pre>

<p>I tried to record a macro and this works but only on one cell and only if the active cell is in the O Column</p>

<pre><code>Sub Macro4()
ActiveCell.FormulaR1C1 = _
    "=SUBSTITUTE(RC[-4],""\"",""?"",LEN(RC[-4])-LEN(SUBSTITUTE(RC[-4],""\"","""")))"
Range("O2").Select
End Sub
</code></pre>

<p>I need to have this put the value in O column starting at O2 for each non empty K starting with K2 regardless of what the active cell is. </p>