Vba change event code

Paris0022

New Member
Joined
May 17, 2015
Messages
30
I am looking for help on setting up a VBA code for a CHANGE EVENT when a cell is entered and VBA kick in.

For Example I have B4 as “Initial Loan amount”, and D4 as “LTV %”. (Example pasted at the bottom of this message)

Purchase price is D1. For this example it’s $6,000,000.

Now going back to the two cells. If I enter 65% in the LTV cell D4, the Initial Loan cell B4 will state $3,900,000 (65% of $6,000,000). But if I change my mind and want to delete both cell, or just replace/overwrite the Initial Loan number for example to $2,100,000, then the LTV cell will automatically update/change to 35%. And if I wanted to go the LTV cell and change it to 60%, the Initial Loan cell will update to $3,600,000.

I am hoping you can help with a VBA code.

I will have 5 Loan rows.

Would like the CHANGE EVENT VBA to work for the following cell.
B4 with D4 (Loan 1)
B5 with D5 (Loan 2)
B6 with D6 (Loan 3)
B7 with D7 (Loan 4)
B8 with D8 (Loan 5)

Thanks,


[TABLE="width: 374"]
<colgroup><col><col><col><col><col span="2"></colgroup><tbody>[TR]
[TD][/TD]
[TD]Loan Amount[/TD]
[TD][/TD]
[TD] 6,000,000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Initial Loan[/TD]
[TD][/TD]
[TD]LTV[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Loan 1[/TD]
[TD] 3,900,000[/TD]
[TD][/TD]
[TD="align: right"]65.0%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Loan 2[/TD]
[TD] [/TD]
[TD][/TD]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Loan 3[/TD]
[TD] [/TD]
[TD][/TD]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Loan 4[/TD]
[TD] [/TD]
[TD][/TD]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Loan 5[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Total[/TD]
[TD] 3,900,000[/TD]
[TD][/TD]
[TD="align: right"]65.0%[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Loan 1[/TD]
[TD] =D4*D1 [/TD]
[TD][/TD]
[TD]=B4/D1[/TD]
[TD="colspan: 2"]Looking for VBA Change Event code[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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