0
私のユーザー定義関数の説明を作成しようとしています。私は何の問題このコードを使用していなかった:VBAでUDFの説明を設定中にエラーが発生しました
Sub RegisterUDF23()
Dim FD As String
FD = "Find the CN value based on landuse and soil type" & vbLf _
& "CNLookup(Landuse As Integer, SoilType As String) As Integer"
Application.MacroOptions macro:="CNLookup", Description:=FD, Category:=14 _
, ArgumentDescriptions:=Array(_
"Integer: (1 to 7)", "String: ""A"", ""B"", ""C"", ""D"" ")
End Sub
をしかし、私は24日の関数に移動し、それのために同じことをやってみたかったとき、私は最後の行に次のエラーを取得する:
は24日、 "RegisterUDF" のコードです失敗しました:実行時エラー'1004':オブジェクトの
メソッド 'MacroOptions' '_Application' はここで
Sub RegisterUDF24()
Dim FD As String
FD = "friction head loss in feet of water per 100 feet of pipe (ft H20 per 100 ft pipe)" & vbLf _
& "HWfriction(roughness As Double, flow As Double, hyd_diameter As Double) As Double" & vbLf _
& "HWfriction = Power(100/roughness, 1.852) * Power(flow, 1.852)/Power(hyd_diameter, 4.8655) * 0.2083"
Application.MacroOptions macro:="HWfriction", Description:=FD, Category:=14
End Sub