Sub InsertPathFileSheetFormula() Select Case Left(ActiveCell.Formula, 4) Case "" ActiveCell.FormulaR1C1 = "=CELL(""filename"",R1C1)" Case "=CEL" ActiveCell.FormulaR1C1 = "=MID(CELL(""filename"",R1C1),FIND(""["",CELL(""filename"",R1C1))+1," & Chr(10) & "FIND(""]"",CELL(""filename"",R1C1))-FIND(""["",CELL(""filename"",R1C1))-1)" Case "=MID" ActiveCell.FormulaR1C1 = "=LEFT(CELL(""filename"",R1C1),FIND(""["",CELL(""filename"",R1C1),1)-1)" Case "=LEF" ActiveCell.FormulaR1C1 = "=RIGHT(CELL(""filename"",R1C1),LEN(CELL(""filename"",R1C1))- FIND(""]"",CELL(""filename"",R1C1),1))" Case "=RIG" ActiveCell.FormulaR1C1 = "" End Select End Sub