My

Alan_CT06

New Member
Joined
Nov 6, 2023
Messages
16
Office Version
  1. 2016
Platform
  1. Windows
VBA Practice.xlsm
BCDEFGH
4IssuerIndustryCouponNotionalCallableMaturityAnnual Interest
5AMZNInternet6.752,500,000No2023
6DELLHardware5.003,000,000Yes2024
7FordAuto6.001,000,000Yes2024
8GMAuto6.253,000,000No2029
9GOOGLInternet6.752,500,000Yes2023
10HWPHardware7.003,500,000Yes2025
11INTCSemiconductors6.001,500,000No2026
12MSFTSoftware6.502,000,000No2026
13NVDASemiconductors7.252,000,000Yes2029
14TSLAAuto7.004,000,000Yes2025
Sheet2


Hi All,

My code (for which I got some help on here) works fine, but I don't understand why it works.

My goal was to create formulas in the Annual Interest column that multiplies the Coupon * Notional * .01.

My Code below, with the line for the formula

>> Interest.Formula = "=" & FirstCoupon.Address(0, 0) & "*" & FirstNotional.Address(0, 0) & "* 0.01"

works well but I don't understand why. I referenced FirstCoupon which is Cell D5, but for the Annual Interest in cell H9, it knew to use D9 rather than D5. Which is correct, but that surprises me.

Is it the (0, 0) after the Address method that indicated that it should reference the cell from Row 9 rather than Row 5.

I would have thought I would of had to put in something more explicit that said 'use the row for Coupon from the same Row of the Interest formula'.

Or in other words, what does the (0, 0) mean? I know the first two parameters of the Address Property are RowAbsolute and ColumnAbsolute, but I thought it was a True/False designation.

expression.Address(RowAbsolute, ColumnAbsolute, ReferenceStyle, External, RelativeTo)
RowAbsolute Optional Variant. True to return the row part of the reference as an absolute reference. The default value is True.
ColumnAbsolute Optional Variant. True to return the column part of the reference as an absolute reference. The default value is True.


>>>>
Sub AnnualInterest()

Set LastRow = Cells.Find(What:="Issuer").End(xlDown)

Set FirstCoupon = Cells.Find(What:="Coupon").Offset(1)
Set Coupon = Range(FirstCoupon, Cells(LastRow.Row, FirstCoupon.Column))

Set FirstNotional = Cells.Find(What:="Notional").Offset(1)
Set Notional = Range(FirstNotional, Cells(LastRow.Row, FirstNotional.Column))

Set FirstInterest = Cells.Find(What:="Annual Interest").Offset(1)

Set Interest = Range(FirstInterest, Cells(LastRow.Row, FirstInterest.Column))

'Enter Formula

Interest.Formula = "=" & FirstCoupon.Address(0, 0) & "*" & FirstNotional.Address(0, 0) & "* 0.01"

End Sub
>>>>

Thank you for any help.
Alan
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
The (0, 0) just means it is a relative cell address rather than an absolute cell address i.e. D9 rather than $D$9

The line below searches for the word Notional, once it finds the cell it references the cell 1 down from the cell with Notional in it
VBA Code:
Set FirstNotional = Cells.Find(What:="Notional").Offset(1)
and that is the cell referenced in
Rich (BB code):
Interest.Formula = "=" & FirstCoupon.Address(0, 0) & "*" & FirstNotional.Address(0, 0) & "* 0.01"
 
Last edited:
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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