creating a macro to calculate interest

bhaktany

New Member
Joined
Nov 3, 2005
Messages
7
I am trying to creat a macro that performs interest calculations by pulling data from various fields in spreadsheet "MLS". For all rows, varies by each deal, in MLS, I will add the total interest and take that amount and place it in spreadsheet "Funding Memo". I am a beginner so i am asking for your help. Thanks again for your suggestions.

'
'accrued interest calculation
'
Worksheets("MLS").Activate
Worksheets("MLS").Range("DI1:DI1").Select
Worksheets("MLS").Range("DI1:DI1").Activate
ActiveCell.Value = "Accrued Interest Calculation"
'
'
'
Dim perdiem As String 'interest per day'
Dim numdays As String 'number of days of interest'
Dim upb2 As String 'current balance used to calculate the interest'
Dim intd As Date 'interest paid to date'
Dim pr_rate As String 'rate'
Dim settledate As Date
Dim interestcalc As String 'interest'

For a = 2 To 6500
Worksheets("MLS").Select.Activate
Set upb2(a) = Worksheets("MLS").Range("AF2")
Set pr_rate(a) = Worksheets("MLS").Range("AH2")
Set perdiem = Application.WorksheetFunction.Product(pr_rate, 0.00003)
Set intd = Worksheets("MLS").Range("AD2")
Worksheets("Funding Memo").Select.Activate
Set settledate = Worksheets("Funding Memo").Range("A3")
Set numdays = Application.WorksheetFunction.Days360(intd, settledate)
Set interestcalc = CLng(Application.WorksheetFunction.Product(perdiem, numdays, upb2))
Worksheets("MLS").Range("DI2").Select
Set Selection = interestcalc
Next a
End

End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Quite a macro for a beginner.

Have you looked at the financial functions available in Excel to see if there is a formula you can use?
 
Upvote 0

Forum statistics

Threads
1,224,889
Messages
6,181,605
Members
453,055
Latest member
cope7895

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