MrExcel's Learn Excel #813 - Code Genie

If you like this content, please consider visiting the video on YouTube and subscribe to the MrExcel Channel to show your support!
This video has been published on Jan 13, 2009.
Ever wonder how MrExcel spends his free time? He watches the macro recorder write code before his eyes. In Episode 813, learn how to arrange the VBA window and the Excel window to watch which lines of code appear in response to actions in Excel.

This blog is the video podcast companion to the book, Learn Excel 97-2007 from MrExcel. Download a new two minute video every workday to learn one of the 377 tips from the book!
maxresdefault.jpg


Transcript of the video:
Hey. Welcome back to the MrExcel netcast. I’m Bill Jelen.
Well, we've been talking about the macro recorder and I want to show off a cool trick here, a cool trick.
Now, if you have any questions for the netcast, of course, you can call in, leave your question as a voicemail, 866-581-0221, or just drop me a note, bill@mrexcel.com, and we can get to you on a future netcast.
I've arranged my window here so that way the Excel window is very small, and, in back, in the background, I show the VISUAL BASIC window, so that's ALT+F11 to get that.
I'm going to turn on the macro recorder.
I will just start the macro recorder, and, in VBA now, we should see that we have modules, and I can open MODULE1, and we can actually see the tiny bit of macro that's been recorded.
Now, switch back to Excel and, in this particular case, I want to rename these sheets.
So, typically, when we start with a brand new worksheet in Excel, we get SHEET1, SHEET2, SHEET3, and you can see that as I do things on the left-hand side, I just changed the application window, that got recorded as code on the right-hand side.
So, I'm going to come here to SHEET1, I'm going to double click that, and call it REVENUE, and it selected the sheet, it changed the name.
Now, over here on the left hand side, I'm going to go through and I'm going to change this to COSTS, and then, on SHEET3, I’ll call it EXPENSES, and it's pretty wild.
When you set this code up so that way you can see both the Excel window and the VBA window, you can actually watch the macro recorder write the code right before your eyes.
It’s a great way to see which lines of code got written in response to doing certain things within the Excel window.
So, if I choose a few cells here, 1, 2, 3, CONTROL+ENTER, it will do 2 things -- first of all, the select, and then it applies a formula.
Now, it uses the old R1C1 formulas here and that's a topic for another day, but it's pretty cool to see these two macros work side by side.
Well, I want to thank you for stopping by and we’ll see you next time for another netcast from MrExcel.
 

Forum statistics

Threads
1,223,635
Messages
6,173,479
Members
452,516
Latest member
archcalx

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