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.
=SUBSTITUTE(K2,"\","?",LEN(K2)-LEN(SUBSTITUTE(K2,"\","")))
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
Sub Macro4()
ActiveCell.FormulaR1C1 = _
"=SUBSTITUTE(RC[-4],""\"",""?"",LEN(RC[-4])-LEN(SUBSTITUTE(RC[-4],""\"","""")))"
Range("O2").Select
End Sub
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.