Macro function returns "too many arguments' error

incajunk

New Member
Joined
Jan 10, 2011
Messages
2
When I insert the function pv() it returns an errorr message "You've entered too many arguments for this function." But I haven't called out too many arguments. Even worse is that I can call out functions pm(), pq() or pd() which are all similar but work! Here is the code for these functions:

Option Explicit

Public support As String, length As Double, gamma As Double, x As Double, P As Double, phi As Double, xg As Double, xf As Double, fg As Double, gf As Double, Cp_0 As Double, Cp_1 As Double, Cp_2 As Double, Cp_3 As Double, Cp_4 As Double

Function pv(support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = 1
End If
If x > phi Then
xf = 1
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
End If
'Calculate Shear
pv = -P * (xf + Cp_0 * xg + Cp_1)
End Function

Function pm(support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
End If
'Calculate Moment
pm = -P * (xf + Cp_0 * xg + Cp_1 * x + Cp_2)
End Function

Function pq(E, I, support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0: Cp_3 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
Cp_3 = -(gf ^ 3 + Cp_1 * gamma ^ 3) / 6 / gamma
End If
'Calculate Slope
pq = -P / E / I * ((xf ^ 2 + Cp_0 * xg ^ 2 + Cp_1 * x ^ 2) / 2 + Cp_2 * x + Cp_3)
End Function

Function pd(E, I, support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0: Cp_3 = 0: Cp_4 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
Cp_3 = -(gf ^ 3 + Cp_1 * gamma ^ 3) / 6 / gamma
End If
'Calculate Deflection
pd = -P / E / I * ((xf ^ 3 + Cp_0 * xg ^ 3 + Cp_1 * x ^ 3) / 6 + Cp_2 * x ^ 2 / 2 + Cp_3 * x + Cp_4)
End Function

Any ideas?

Thanks in advance.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
That solved it. Thanks. Is there a simple alphabetical list somewhere of all the built-in functions?
 
Upvote 0
Somewhere I think I have a link ... if I find it I'll post back. PV probably doesn't sound like a candidate VB function unless you are in finance! If you type VBA. (VBA dot) in the Visual Basic Editor you'll probably get a list. Although this may be something specific to vba in Excel-hosted applications here.
ξ
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,803
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top