添加"得到公式"功能在Mac excel中

时间:2014-08-31 14:44:17

标签: excel excel-vba vba

我需要实现get公式函数 我将以下内容放在Visual Basic编辑器中

Function getformula(r As Range) As String
  Application.Volatile
  If r.HasArray Then
  getformula = "<-- " & " {" & r.FormulaLocal & "}"
  Else
  getformula = "<-- " & " " & r.FormulaLocal
  End If
End Function

但它不起作用并且显示&#34; NAME&#34;错误

1 个答案:

答案 0 :(得分:-1)

Function getformula(r As Range) As String
    Application.Volatile
    If r.HasArray Then
    getformula = "<-- " & _
     " {" & r.FormulaLocal & "}"
    Else
    getformula = "<-- " & _
    " " & r.FormulaArray
    End If
End Function