From the course: Excel: Learning VBA

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Add code to a recorded macro

Add code to a recorded macro - Microsoft Excel Tutorial

From the course: Excel: Learning VBA

Add code to a recorded macro

- [Instructor] Writing VBA code can take a lot of time, but there is a shortcut. Many times, you can record a macro that does what you want and then change it by editing the macro in the Visual Basic editor. In this movie, I will show you one scenario where that would be very useful. My sample file is 01_10_RecordFirst, and you can find it in the Ch01 folder of the Exercise Files collection. In this workbook, on the PivotSummary worksheet, I have a pivot table, and you can see that I have the Year in the Columns area and Sum of Total in the Values area, but nothing in the Rows area. So what I'll start by doing is adding Month to the Rows area and record a macro of me doing that, and then edit it, so that instead of Month, it will do Infusion. And Infusion just means a flavor that is added, in this case, to olive oil. So I'll start by ensuring that a cell within the pivot table is selected, in this case B5. And…

Contents