|
The VBA for Excel Programming EnvironmentThe programming environment in VBA for Excel is one of the most friendly and forgiving. Its two main components are the Visual Basic Editor and the Macro Recorder. The latter will be your teacher (and a very good one) for the first few weeks . It will then become your permanent assistant writing long sentences of code without complaining and without typos. In this section we will also learn about the security aspects in the VBA for Excel and the events (what triggers the VBA procedures). Visual Basic Editor (VBE) in ExcelThe most user friendly programming environment. You will create your procedures (macros) and userforms in the VBE. You will modify and test these components and even make changes while you are testing your procedures step by step. The Project Window in the Visual Basic Editor of ExcelWhere you see all the open workbooks, where you add modules and userforms The Properties Window in the Visual Basic Editor of ExcelThe properties of the workbooks, the names of the modules and the properties of all the components of the userforms. The Code Window in the Visual Basic Editor of ExcelWhere you write and test all your code Developing Macros in the VBEYou are becoming so good that you don't need the macro recorder sometimes. Here is how you create a new VBA procedure from scratch. Testing Macros in the VBESplit your screen, use the F8* key and see what you procedure does in Excel step by step. Back up, correct and re-test. Excel Macro RecorderYou can use the recorder to develop macros rapidly. If you want to do more the Macro Recorder is the best teacher and will be a great assistant even when you become an expert at programming in VBA. It WRITES the code for you. In this chapter you will learn about and try the Macro Recorder. You will run the macro that you have recorded. Modifying Macros in the VBEThe macro recorder is a great helper and teacher but it sometimes makes it complicated. Here is a recorded macro simplified. VBA Security and ProtectionProtect you code, your sheets and your computer. VBA EventsFor a procedure to start it must be triggered, you click on a button, you close a workbook, the value of a cell changes. Find the right event. |