Providing cost-effective Excel and financial modelling training courses.

## Why you don't need to be a VBA Macro master to build a Financial Model – Part 2

In part 2 of our “Why you don’t need to be a macro master to build a Financial Model” we are going to look at the main types of macros you’ll need to produce an advanced financial model. The three types of macros we are going to look at are:

1. A goal seek macro – can be used to break a circularity
2. A single cell copy and paste macro – we covered this in part 1 of this series
3. A multiple cell copy and paste macro

## Goal Seek Macro

Ok, this is probably the easiest macro to implement. It is very similar to the single cell copy and paste macro. If you are not aware of what a goal seek is we will try and sum it up in a line or two.
A goal seek will try and solve a certain cell to a specified value by changing another. If you look at the below figure we have 50 sales, each with a profit margin of \$3.5/unit giving a total profit of \$175. We want to know what the profit margin would have to be to get a total profit of \$200. Obviously the profit margin has to be \$4 per unit. But look how we found it. We goal seeked it by setting the total profit cell to 200 by changing the profit margin per unit.

Ok, now let’s cheat by going back to our spreadsheet in part 1. As per part 1 we are going to record a macro. Go to View, Macros, Record Macro. Let’s call the macro GoalSeek. Go to the DebtCheck value and select Data, What-if Analysis and then Goal Seek. We want to select to value 0, by changing cell DebtHard value as per the below figure.

Stop the recording by pressing the stop button in the bottom left hand corner.

Now let’s edit the macro. Go to View then Macros, View Macros. Select the GoalSeek macro and press edit.

We are going to delete the Range(“D13”).Select at the top. And we are going to replace the cells with their actual names as per below.

Now go back to the spreadsheet. Put 12,500 into the DebtHard cell (G12). Go to Data, Macro and View Macro. Select GoalSeek and press Run. This should solve the macro and set the DebtCheck to 0.

## Single Cell Copy and Paste Macro

Now we looked at a single cell copy and paste macro in the first part of this series so we are not going to cover it here. If you want to check out that article, click here.

## Multiple Cell Copy and Paste Macro

Ok, we’re going to leave you to do a bit of homework on this one. Depending on how you go we might look at doing a third part to this tutorial. Go to the spreadsheet and scroll down to question two. See how you go with it. If you’d like us to do a third part to this macros series leave us a comment or send us an email. Hint: In this question you might find that the countif function will come in handy.

By | 2012-09-22T10:19:39+00:00 September 22nd, 2012|Blog|3 Comments