Skip to content
Felix
  • Topics
    • My List
    • Felix Guide
    • Asset Management
    • Coding and Data Analysis
      • Data Analysis and Visualization
      • Financial Data Tools
      • Python
      • SQL
    • Credit
      • Credit Analysis
      • Restructuring
    • Financial Literacy Essentials
      • Financial Data Tools
      • Financial Math
      • Foundations of Accounting
    • Industry Specific
      • Banks
      • Chemicals
      • Consumer
      • ESG
      • Insurance
      • Oil and Gas
      • Pharmaceuticals
      • Project Finance
      • Real Estate
      • Renewable Energy
      • Technology
      • Telecoms
    • Introductory Courses
    • Investment Banking
      • Accounting
      • Financial Modeling
      • M&A and Divestitures
      • Private Debt
      • Private Equity
      • Valuation
      • Venture Capital
    • Markets
      • Economics
      • Equity Markets and Derivatives
      • Fixed Income and Derivatives
      • Introduction to Markets
      • Options and Structured Products
      • Other Capital Markets
      • Securities Services
    • Microsoft Office
      • Excel
      • PowerPoint
      • Word & Outlook
    • Professional Skills
      • Career Development
      • Expert Interviews
      • Interview Skills
    • Risk Management
    • Transaction Banking
    • Felix Live
  • Pathways
    • Investment Banking
    • Asset Management
    • Equity Research
    • Sales and Trading
    • Commercial Banking
    • Engineering
    • Operations
    • Private Equity
    • Credit Analysis
    • Restructuring
    • Venture Capital
    • CFA Institute
  • Certified Courses
  • Ask An Instructor
  • Support
  • Log in
  • Topics
    • My List
    • Felix Guide
    • Asset Management
    • Coding and Data Analysis
      • Data Analysis and Visualization
      • Financial Data Tools
      • Python
      • SQL
    • Credit
      • Credit Analysis
      • Restructuring
    • Financial Literacy Essentials
      • Financial Data Tools
      • Financial Math
      • Foundations of Accounting
    • Industry Specific
      • Banks
      • Chemicals
      • Consumer
      • ESG
      • Insurance
      • Oil and Gas
      • Pharmaceuticals
      • Project Finance
      • Real Estate
      • Renewable Energy
      • Technology
      • Telecoms
    • Introductory Courses
    • Investment Banking
      • Accounting
      • Financial Modeling
      • M&A and Divestitures
      • Private Debt
      • Private Equity
      • Valuation
      • Venture Capital
    • Markets
      • Economics
      • Equity Markets and Derivatives
      • Fixed Income and Derivatives
      • Introduction to Markets
      • Options and Structured Products
      • Other Capital Markets
      • Securities Services
    • Microsoft Office
      • Excel
      • PowerPoint
      • Word & Outlook
    • Professional Skills
      • Career Development
      • Expert Interviews
      • Interview Skills
    • Risk Management
    • Transaction Banking
    • Felix Live
  • Pathways
    • Investment Banking
    • Asset Management
    • Equity Research
    • Sales and Trading
    • Commercial Banking
    • Engineering
    • Operations
    • Private Equity
    • Credit Analysis
    • Restructuring
    • Venture Capital
    • CFA Institute
  • Certified Courses
Felix
  • Data
    • Company Analytics
    • My Filing Annotations
    • Market & Industry Data
    • United States
    • Relative Valuation
    • Discount Rate
    • Building Forecasts
    • Capital Structure Analysis
    • Europe
    • Relative Valuation
    • Discount Rate
    • Building Forecasts
    • Capital Structure Analysis
  • Models
  • Account
    • Edit my profile
    • My List
    • Restart Homepage Tour
    • Restart Company Analytics Tour
    • Restart Filings Tour
  • Log in
  • Ask An Instructor
    • Email Our Experts
    • Felix User Guide
    • Contact Support

Introduction to Macros

Understand the Macro recording basics, Macro security, running macros, and how to use the VBA editor.

Unlock Your Certificate   
 
0% Complete

14 Lessons (49m)

Show lesson playlist
  • 1. Macros Overview and Settings

    02:35
  • 2. Recording a Macro

    06:52
  • 3. Macro Relative References

    03:26
  • 4. Macro Security

    04:10
  • 5. Running Macros - Keyboard

    02:11
  • 6. Running Macros - QAT

    03:27
  • 7. Running Macros - Worksheet Object

    02:17
  • 8. Running Macros - Ribbon

    02:59
  • 9. The VBA Editor - Overview

    04:37
  • 10. The VBA Editor - Organizing

    02:39
  • 11. The VBA Editor - Comments

    02:14
  • 12. The VBA Editor - Backup

    01:25
  • 13. Recording Macros with Calculations

    11:15
  • 14. Introduction to Macros Tryout


Prev: Database Analysis

Recording Macros with Calculations

  • Notes
  • Questions
  • Transcript
  • 11:15

Recording Macros with Calculations

Downloads

Excel VBA And Macros - Introduction Workout EmptyExcel VBA And Macros - Introduction Workout Full

Glossary

Excel Macros VBA
Back to top
Financial Edge Training

© Financial Edge Training 2025

Topics
Introduction to Finance Accounting Financial Modeling Valuation M&A and Divestitures Private Equity
Venture Capital Project Finance Credit Analysis Transaction Banking Restructuring Capital Markets
Asset Management Risk Management Economics Data Science and System
Request New Content
System Account User Guide Privacy Policy Terms & Conditions Log in
Transcript

Let's have a look at a more complex example involving formulas and calculations when recording. Let's imagine every day, week, month, I get sent some data. Sometimes the list is a little bigger or smaller, but it's always in this format. So I've got an order, a region, the city where it was placed, a category, a product, quantity, and a unit price. What I need to do is add a column to calculate quantity times price, and include a grand total at the bottom of this new totals column. And then finally, apply some formatting to tidy things up. I can see this is gonna take a while to do and I don't want to make a mistake, so I'm gonna make a list of steps and importantly, the way we do each step. So here's my list of steps. And as you are making your list of these steps, you need to think about how that is gonna be recorded. And if I was not sure about that, I might want to do some testing on just that aspect before I recorded the whole thing. For example, when I press the enter key, I'd wanna make sure that the cursor stays where it is, rather than moves down a cell. So, I'd turn that off in options before I started doing my recording. We are gonna start recording and then we're gonna talk about these different challenges as we go through.

So first things first then, let's start recording. So that's Alt-L-R and we're gonna give our macro a name and we're gonna call it totals and formatting.

I am not gonna worry about a shortcut key, but I am gonna make sure that I'm storing this macro in this workbook,.

Click okay.

And now we're recording and we just need to go through the steps that I've got in my list that I pre-prepared in the order and making sure that I'm doing the steps appropriately. So let's go and have a look at that list again, just remind ourselves what the first steps are. So it says that I should be using Control-G to go to I4. Now the reason for this is if we think about what we could have done instead is I'm currently over in column H here, and I could of course use the cursor keys to move across one or I could use all kinds of different keys, but of course I won't know where a particular one was starting. So good idea to just save ourselves the minimum amount of steps and I'm gonna do control-G and go to I4.

Then we're gonna have our label. So let's have a look at our list and see what we're gonna call it. We're gonna call it order total.

And now we're gonna move down a cell to I5. Now whenever you are moving in Excel, when you're recording you need to think about do I need to have relative references turned on or off? And in this case it doesn't matter because at the minute we've already hard-coded ourselves going to I4, and actually we can still continue to hard-code ourselves going to I5. So I can use to do the down arrow key. I don't need relative references on at this point. The next thing we need to do is write our formula. So obviously this is just gonna be equal to our quantity multiplied by our unit price.

And there's our answer. Now, if I'd stopped recording now and went to have a go and look at the code to see what I'd got recorded, we would see that Excel uses a different formula format for recording formulas in VBA as opposed to how we write them in Excel. So we wrote equals G five times H five, but actually if we were to look at the recorded code we would see that actually it recorded a relative reference. So what it recorded us doing was multiplying the cell that's two cells to the left by the cell that is one cell to the left. So this is good news for us, right, because it means that whenever I'm entering formulas in Excel in this way I know this is ex, how Excel works, and this is perfect. Okay, so I've done one formula obviously the next job is to copy that down the column. Now to do that I, I'm gonna use column H as a traveling column. So I'm gonna move across to column H and then we're gonna go down that column. Let's go across to our instructions and see what I've made a note of. So I've done my formula my next instruction is to copy I5. Then I can use my left arrow key, and then I can use control and down arrow key to get down to the bottom of the column. So let's go and do those steps next. So I'm gonna do Control-C to copy, arrow key across once Control-arrow down key to jump down to the bottom and let's come back to our list of instructions and see what's next. So I've got myself down to H248 and I've put myself an instruction that says I need to turn on relative references, references at this point. And that's because I need to move down, sorry, move across one column to the right because obviously now I need to go across the right, I don't need to recall myself selecting the G248.

Absolutely. So I need to make sure that relative references are turned on. So let's go back to Excel and go to Alt-L.

And then U for turning on relative references. Now I can move across one, and then I'm going to use I'm gonna turn relative references off again because I want to go back to using absolute references. So that is Alt-L-U again.

Now I'm going to use control and shift and up to get to the top and then I can use enter to paste in my formulas.

Okay, so that's that column completed. Let's go back to our list of instructions to see what's next. So now I've pasted in my copied formula, it says that I need to do Control-G and go to H4. So the top of column H is where I need to get to next. Then I'm gonna use control and down arrow to come to the bottom of the column. Then I'm gonna turn on relative references 'cause I'm gonna move down a couple of cells and that's where I'm gonna have my label for total sales. So let's get down to those steps. So let's go again, go back to Excel, let's do control and G to go to H4, which is the top of column H. And I'm gonna use control and down arrow. And then I'm gonna turn on relative references which is Alt-L-U, and then I'm gonna move down two cells. And then we are gonna go and enter in our label. So let's come back to here.

And it says we are gonna use total sales as our label.

So let's type that one in.

And I'm gonna make that bold.

I still have relative references turned on, which is good because I need to now move across one column to the right to get to where I want to do my top total. And we're just gonna do our normal sum function. And then we're gonna have a little chat about how we're gonna edit it slightly to make this work with a recorded macro situation. So we're just gonna do equal sum open bracket And then I'm gonna come up to my I248 cell and then Control-shift-up arrow to select to the top, shift-down. And then what we're gonna do is we're just gonna edit this formula slightly. Now, normally this would be fine, I5 to I248, but remember we said that this is going to record us doing this relative style of referencing. What I need to tell Excel is that in this recorded situation, every time you run this macro, I want to record myself selecting something from I5 down to some flexible amount at the bottom. And we know how to fix stuff in formulas because we've done it before, right? We use dollar signs to do this. So I'm just gonna use my cursor keys to come across and edit the cell I5, F4 to go and fix that.

And then I'm gonna come back to the end of the sum function, close my bracket, and press enter. So there's our total. I need to think about while I'm here. I'm gonna apply some formatting. So I'm gonna bold this, yeah. And then I'm also gonna add some borders. So I'm gonna go to Alt-H and then B for borders And then I'm gonna have a top and bottom border. So let's go for all, that's C.

Let's go back to our list and see how we're getting on.

So we've done our total sales, we've typed in our sum function, we've applied the formatting but now it's telling us that I'm gonna go back to using Control-G to jump right up to the top of the table. Now when I'm doing the formatting you'll see what I've done is I'm applying the formatting to the whole of the table first and then I'm gonna select just the top header row and apply some formatting to just that. So again, just gotta think about the order that you're going through to save yourself doing the, you know the least amount of steps. So let's go to the top. So I'll go back to Excel Control and G and I'm going to go to B4.

And we're gonna do Control-Shift-Right Control-Shift-Down to go and select our table. I'm then gonna apply some formatting. So let's add some borders, so Alt-H-B and let's do all borders, which is A and then I'm gonna apply a thick board around the outside which is Alt-H-B, and then T for thick. The next step is, I need to do something to the header row. So I'm gonna do Control-G again, I'm gonna go to B4.

And then Control-Shift-Right to select the top row. And then let's go and apply those thick borders around the outside of that selection. So that's Alt-H-B, T. And then let's go and add a formatting to the top row as well. So let's go with a highlight color. So Alt-H-H and let's go and have a light blue.

Let's go back to my little list instructions and see how I'm doing. I've done that. The last step then is just simply to go and tidy up and go and select B4 so that we don't have a selection left after I've finished recording my macro. So back to Excel and then control and G, B4, enter and then I need to stop recording. So that is Alt-L-R. So now what I've created is a very flexible macro which allows me to do formulas and calculations on a piece of data, which can change in size.

Content Requests and Questions

You are trying to access premium learning content.

Discover our full catalogue and purchase a course Access all courses with our premium plans or log in to your account
Help

You need an account to contact support.

Create a free account or log in to an existing one

Sorry, you don't have access to that yet!

You are trying to access premium learning content.

Discover our full catalogue and purchase a course Access all courses with our premium plans or log in to your account

You have reached the limit of annotations (10) under our premium subscription. Upgrade to unlock unlimited annotations.

Find out more about our premium plan

You are trying to access content that requires a free account. Sign up or login in seconds!

Create a free account or log in to an existing one

You are trying to access content that requires a premium plan.

Find out more about our premium plan or log in to your account

Only US listed companies are available under our Free and Boost plans. Upgrade to Pro to access over 7,000 global companies across the US, UK, Canada, France, Italy, Germany, Hong Kong and more.

Find out more about our premium plan or log in to your account

A pro account is required for the Excel Add In

Find out more about our premium plan

Congratulations on completing

This field is hidden when viewing the form
Name(Required)
This field is hidden when viewing the form
Rate this course out of 5, where 5 is excellent and 1 is terrible.
Were the stated learning objectives met?(Required)
Were the stated prerequisite requirements appropriate and sufficient?(Required)
Were the program materials, including the qualified assessment, relevant and did they contribute to the achievement of the learning objectives?(Required)
Was the time allotted to the learning activity appropriate?(Required)
Are you happy for us to use your feedback and details in future marketing?(Required)

Thank you for already submitting feedback for this course.

CPE

What is CPE?

CPE stands for Continuing Professional Education, by completing learning activities you earn CPE credits to retain your professional credentials. CPE is required for Certified Public Accountants (CPAs). Financial Edge Training is registered with the National Association of State Boards of Accountancy (NASBA) as a sponsor of continuing professional education on the National Registry of CPE Sponsors.

What are CPE credits?

For self study programs, 1 CPE credit is awarded for every 50 minutes of elearning content, this includes videos, workouts, tryouts, and exams.

CPE Exams

You must complete the CPE exam within 1 year of accessing a related playlist or course to earn CPE credits. To see how long you have left to complete a CPE exam, hover over the locked CPE credits button.

What if I'm not collecting CPE credits?

CPE exams do not count towards your FE certification. You do not need to complete the CPE exam if you are not collecting CPE credits, but you might find it useful for your own revision.


Further Help
  • Felix How to Guide walks you through the key functions and tools of the learning platform.
  • Playlists & Tryouts: Playlists are a collection of videos that teach you a specific skill and are tested with a tryout at the end. A tryout is a quiz that tests your knowledge and understanding of what you have just learned.
  • Exam: If you are collecting CPE points you must pass the relevant CPE exam within 1 year to receive credits.
  • Glossary: A glossary can be found below each video and provides definitions and explanations for terms and concepts. They are organized alphabetically to make it easy for you to find the term you need.
  • Search function: Use the Felix search function on the homepage to find content related to what you want to learn. Find related video content, lessons, and questions people have asked on the topic.
  • Closed Captions & Transcript: Closed captions and transcripts are available on videos. The video transcript can be found next to the closed captions in the video player. The transcript feature allows you to read the transcript of the video and search for key terms within the transcript.
  • Questions: If you have questions about the course content, you will find a section called Ask a Question underneath each video where you can submit questions to our expert instructor team.