I am trying to use vba to insert a formula into cell on my Sheet. I believe it can be done with the formula I have below, but unfortunately I do not know how to fix my syntax below.
What's wrong with my FormulaLocal syntax?
The strange thing is that using R.Formula, it works, but the cell gets the error #NAME
Sub InsertIFERROR()
Dim R As Range
Set R = Application.InputBox("Select a range", "Get Range", Type:=8)
R.Select
For Each R In Selection.SpecialCells(xlCellTypeFormulas)
R.FormulaLocal = "=SEERRO(" & Mid(R.FormulaLocal, 2) & ",""-"")"
Next R
End Sub
Be especially careful about the regional version of your Excel. The PT-PT version uses SE.ERRO with a semicolon as a list separator while the PT-BR version uses SEERRO (and typically a comma as a list separator).
Try this....Hope it will work and make sense where you done mistake.