How to fix this error? Wrong number of arguments or invalid property assignment.

jassyphee

New Member
Joined
Jan 8, 2014
Messages
16
Function calOriginalAsset(sheetName As String, startCol As String, startRow As Integer)
Sheets(sheetName).Activate

Dim lngMyRow As Long
lngMyRow = Cells(Rows.Count, "B").End(xlUp).row

Range("B" & lngMyRow + 1).Formula = "=SUM(B7:B" & lngMyRow & ")" 'Sums from Row 7. Change to suit.
End Function
Sub getTotals()
Dim nm As Name
For Each nm In ThisWorkbook.Names
Dim n As String
n = Split(nm, "!")(0)
If Right(n, Len(n) - 1) <> "Investment" Then
Range(nm).Offset(0, -1).Value = ""
Else
Range(nm).Offset(-2, -3).Clear
Range(nm).Offset(-2, -2).Clear
Range(nm).Offset(-2, -0).Clear

Range(nm).Offset(2, -3).Clear
Range(nm).Offset(2, -2).Clear
Range(nm).Offset(2, 0).Clear

Range(nm).Offset(0, -3).Clear

End If
Range(nm).Clear
nm.Delete
Next nm

calOriginalAsset "Original Assets", "B", 7, "Total_Assets", "TOTAL ASSETS"
calSum "Cap. Rec.", "D", 5, "Total_Receipts", "Total Receipts"
calSum "Cap. Disb.", "D", 5, "Total_Disbursements", "Total Disbursements"
calSum "Rev. Rec.", "D", 5, "Total_Revenue_Receipts", "Total Revenue Receipts"
calSum "Rev. Disb.", "D", 5, "Total_Revenue_Disbursements", "Total Revenue Disbursements"
calSum "Unrealized", "B", 3, "Unrealizedoriginalassets", "Total"
calSum "Invest on hand", "B", 3, "Invest_On_Hand", "Total"
calInvestment "Investment", "D", "F", 5

End Sub
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi

If you take your emboldened line you have 5 parameters but your module has only 3 parameters.

hth
 
Upvote 0

Forum statistics

Threads
1,216,499
Messages
6,131,010
Members
449,613
Latest member
MedDash99

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