Beginning VBA - Recording Macros and VBE - Watch in Real Time

Опубликовано: 06 Октябрь 2024
на канале: EverydayVBA
1,115
10

Grab the Free VBA Quick Reference Guide
https://www.chrisjterrell.com/excel-v...
https://chrisjterrell.com/blog/203666...

Big Challenge:
When recording a macro where does the code go and how does it work. Is it possible to see my recording in action? Watch this video to see how.

The Solution:
Record a Macro and Watch what happens in real-time. Then you can see what happens in the Project and Property window

Opening the Visual Basic Editor (3 Ways):
Alt + F11
Developer Ribbon - Visual Basic
View - Macros - Select Macro - Edit

Split Your Screens so you have both Excel and the VBE open
Record Macro - Either Using Button on the bottom left corner, the View tab - Macros or Developer tab - Record Macro
Name your Macro - Remember No Spaces are allowed
Find the Module in your VBE editor with the Macro you just created and watch as you record
NOTE: remember the Macro Recorder is very literal and it will record some code that can be deleted.

The Visual Basic Editor or VBE
Project window - Shows all open Excel Workbook
** If you see the "Personal.xlsb" file is a workbook that is open but you can't see it. It is pretty cool because you can write code that is saved there that you can run on open workbooks
Properties - Shows the properties of whatever is selected in the Project window. So if a sheet is selected then the sheet properties will be visible.
Code Window - where the code is written and saved
Immediate Window - More info Here
Locals Window - Shows the Variables during run time. It is great for debugging code