I use the following line to insert the formula for a sheet name:
Sub Sheetname() ' Inserts Sheet name formula into active cell ActiveCell.Formula = _ "=MID(CELL(""FILENAME"",A1),FIND(""]"",CELL(""FILENAME"",A1))+1,255)" ActiveCell.Select End Sub
This works perfectly in a workbook, but when put into an AddIn, it gives an "Argument not Optional" error. I have looked in Help but can't find what argument I am missing, and why it only matters in an AddIn?
BTW: I realise it is easier to insert sheetname from the sheet property, but I specifically want the formula