Excel Macros – Useful Resources

Excel Macros – Useful Resources ”; Previous Next The following resources contain additional information on Excel Macros. Please use them to get more in-depth knowledge on this topic. Useful Video Courses Microsoft Excel Course: Managing and Auditing Data 80 Lectures 1.5 hours Debbie McCusker More Detail Bulk Emails using Outlook and Excel Macros (VBA) 14 Lectures 43 mins Kamal Kishor Girdher More Detail Excel – A Step by Step Complete Course 56 Lectures 6 hours TELCOMA Global More Detail Microsoft Excel 2016: Part 3 (Expert Level) 40 Lectures 1.5 hours Sonic Performance More Detail Learn MS Excel, Data Analysis, and Financial Analysis 50 Lectures 3 hours Tayana Grubisic More Detail Learn microsoft excel course for data analysis Zero to hero 50 Lectures 2 hours ADITYA More Detail Print Page Previous Next Advertisements ”;

Excel Macros – Creation

Excel Macros – Creation ”; Previous Next You can create a macro with Excel commands by recording the key strokes and mouse clicks, giving the macro a name and specifying how to store the macro. A macro thus recorded can be run with an Excel command. Suppose you have to collect certain results repeatedly in the following format − Instead of creating the table each time, you can have a macro to do it for you. Recording a Macro To record a macro do the following − Click the VIEW tab on the Ribbon. Click Macros in the Macros group. Select Record Macro from the dropdown list. The Record Macro dialog box appears. Type MyFirstMacro in the Macro name box. Type A Simple Macro in the Description box and click OK. Remember that whatever key strokes and mouse clicks you do, will be recorded now. Click in the cell B2. Create the table. Click in a different cell in the worksheet. Click the VIEW tab on the Ribbon. Click Macros. Select Stop Recording from the dropdown list. Your macro recording is completed. The first step to click on a particular cell is important as it tells where exactly the macro has to start placing the recorded steps. Once you are done with the recording, you have to click Stop Recording to avoid recording of unnecessary steps. Running a Macro You can run the macro you have recorded any number of times you want. To run the macro, do the following − Click on a new worksheet. Note the active cell. In our case, it is A1. Click the VIEW tab on the Ribbon. Click Macros. Select View Macros from the dropdown list. The Macro dialog box appears. Only the macro that you recorded appears in the Macros list. Click the macro name – MyFirstMacro in the Macro dialog box. The description you typed while recording the macro will get displayed. Macro description allows you to identify for what purpose you have recorded the macro. Click the Run button. The same table that you have created while recording the macro will appear in just a split of a second. You have discovered the magic wand that Excel provides you to save time on mundane tasks. You will observe the following − Though the active cell before running the macro was A1, the table is placed in the cell B2 as you have recorded. In addition, the active cell became E2, as you have clicked that cell before you stopped recording. You can run the macro in multiple worksheets with different active cells before running the macro and observe the same conditions as given above. Just keep a note of this and you will understand later in this tutorial why it has occurred so. You can also have a macro recording that places your recorded steps in the active cell. You will learn how to do this as you progress in the tutorial. Storing a Macro You might wonder how to save the macros that are created. In this context you need to know − Storing a macro Saving a macro enabled file As and when you create a macro, you can choose where to store that particular macro. You can do this in the Record Macro dialog box. Click the box – Store macro in. The following three options are available − This Workbook. New Workbook. Personal Macro Workbook This Workbook This is the default option. The macro will be stored in your current workbook from where you created the macro. New Workbook This option, though available, is not recommended. You will be asking Excel to store the macro in a different new workbook and mostly it is not necessary. Personal Macro Workbook If you create several macros that you use across your workbooks, Personal Macro Workbook provides you with the facility to store all the macros at one place. You will learn more about this option in the next chapter. Saving a Macro Enabled File If you had chosen This Workbook as the option for storing the macro, you would need to save your workbook along with the macro. Try to save the workbook. By default, you would be asking Excel to save the workbook as an .xls file. Excel displays a message saying that an Excel feature VB project cannot be saved in a macro free workbook, as shown below. Note − If you click Yes, Excel will save your workbook as a macro free .xls file and your macro that you stored with This Workbook option will not get saved. To avoid this, Excel provides you an option to save your workbook as a macro-enabled workbook that will have .xlsm extension. Click No in the warning message box. Select Excel Macro-Enabled Workbook (*.xlsm) in the Save as type. Click Save. You will learn more about these in later chapters in this tutorial. Print Page Previous Next Advertisements ”;

Excel Macros – Absolute References

Excel Macros – Absolute References ”; Previous Next Excel macros can be recorded either with absolute references or relative references. A macro recorded with absolute references places the recorded steps exactly in the cells where it was recorded, irrespective of the active cell. On the other hand, a macro recorded with relative references can perform the recorded tasks at different parts on the worksheet. You will learn about absolute references for macro in this chapter. You will learn about relative references in the next chapter. Suppose you have to submit a report about your team’s work at the end of every day in the following format − Now, the report should be placed in the cell B2 and should be in the given format. A sample filled in report will be as shown below − Except for the data in the following cells, the information is constant for every report that you generate for the project. C3 – Report for Date. C13 – No. of Tasks Completed Today. C14 – Total No. of Tasks Completed. C15 – % Work Complete. Of these also, in C3 (Report for Date) you can place the Excel function = TODAY () that places the date of your report without your intervention. Further, in cell C15, you can have the formula C14/C12 and format the cell C15 as percentage to have the % Work Complete calculated by Excel for you. This leaves you with only two cells – C13 and C14 that need to be filled in by you every day. Hence, it would be ideal to have information for the rest of the cells, every time you have to create the report. This saves time for you and you can do the mundane activity of reporting in just few minutes. Now, suppose you have to send such reports for three projects. You can imagine the time you can save and take up more challenging work for the day and of course get the accolades from your management. You can achieve this by recording a macro per project and running them on a day-to-day basis to generate the required reports in a matter of just few minutes. However, every time you run the macro, the report should appear on the worksheet as given above, irrespective of the active cell. For this, you have to use absolute references. Ensuring Absolute References To record a macro with absolute references, you have to ensure that the macro is being recorded starting from the cell where the steps have to start. This means, in the case of the example given in the previous section, you need to do the following − Start recording the macro. Create a new worksheet. Click in any cell other than B2 in the new worksheet. Click in the cell B2. Continue recording the macro. This will create a new worksheet for every new report and get the report format placed in the cell B2 every time you run the macro. Note − The first three steps given above are essential. If you do not create a new worksheet, when you run the macro, it places whatever you recorded on the same worksheet at the same place. This is not what you want. You need to have every report on a different worksheet. If you do not click in a different cell at the beginning of the recording, even if the active cell is B2, Excel places the recorded steps in the active cell. When you run the macro, it will place the recorded report format at any part of the worksheet based on the active cell. By explicitly clicking in a cell other than B2 and then the the cell B2, you are telling the recorder to always place your macro steps in the cell B2. Recording a Macro You can start recording the macro with the Record Macro command on the Ribbon under the VIEW tab → Macros. You can also click the Start Recording Macro button present on left side of the Excel task bar. Start recording the macro. The Record Macro dialog box appears. Give a meaningful name to identify the macro as a report of a particular project. Select This Workbook under Store macro in, as you will produce reports from this specific workbook only. Give a description to your macro and click OK. Your macro starts recording. Create a new worksheet. This ensures your new report will be on a new worksheet. Click in any cell other than B2 in the new worksheet. Click in the cell B2. This ensures that the macro places your recorded steps in B2 always. Create the format for the report. Fill in the static information for the project report. Place = TODAY () in C3 and = C14/C12 in the cell C15. Format the cells with dates. Stop recording the macro. You can stop recording the macro either with the Stop Recording command on the Ribbon under VIEW tab → Macros or by clicking the Stop Recording Macro button present on left side of the Excel task bar. Your Project Report macro is ready. Save the workbook as a macro-enabled workbook (with .xlsm extension). Running a Macro You can generate any number of reports in a few seconds just by running the macro. Click the VIEW button on the Ribbon. Click Macros. Select View Macros from the dropdown list. The Macro dialog box appears. Click the macro Report_ProjectXYZ. Click the Run button. A new worksheet will be created in your workbook, with the report stencil created in it in the cell B2. Print Page Previous Next Advertisements ”;

Excel Macros – Configuring a Macro

Excel Macros – Configuring a Macro ”; Previous Next You can record a macro and save it with the name Auto_Open to run it whenever you open the workbook that contains this macro. You can also write VBA code for the same purpose with the Open event of the workbook. The Open event runs the code in the sub procedure Workbook_Open () every time you open the workbook. Recording an Auto_Open Macro You can record an Auto_Run macro as follows − Click the VIEW tab on the Ribbon. Click Macros. Click Record Macro. The Record Macro dialog box appears. Type Auto_Run for the macro name. Type a description and click OK. Start recording the macro. Stop Recording. Save the workbook as macro enabled workbook. Close the workbook. Open the workbook. The macro Auto_Run will run automatically. If you want Excel to start without running an Auto_Open macro, hold the SHIFT key when you start Excel. Limitations of Auto_Open Macro The following are the limitations of Auto_Open macro − If the workbook in which you saved the Auto_Open macro contains code for workbook Open event, the code for the Open event will override the actions in the Auto_Open macro. An Auto_Open macro is ignored when the workbook is opened by running code that uses the Open method. An Auto_Open macro runs before any other workbooks open. Hence, if you record actions that you want Excel to perform on the default Book1 workbook or on a workbook that is loaded from the XLStart folder, the Auto_Open macro will fail when you restart Excel, because the macro runs before the default and startup workbooks open. If you encounter any of these limitations, instead of recording an Auto_Open macro, you must write a code for the Open event as described in the next section. VBA Code for Open Event of a Workbook You can write code that will get executed when you open a workbook. VBA provides you with an event called open that incorporates a VBA procedure for the actions to be done on opening a workbook. Open the workbook in which you stored the macro that you have written for the absolute references – Report_ProjectXYZ. When this macro is run, a new worksheet will be added in the workbook and the project report structure appears on the new worksheet. You can write a macro code that will perform these actions when you open the workbook. That means when you open the Project Report workbook, a new worksheet with the report structure will be ready for you to enter the details. Follow the below given procedure in VBA editor− Double click on ThisWorkbook in Projects Explorer. In the code window, select Workbook in the left dropdown list and Open in the right dropdown list. Sub Workbook_Open () appears. Click Modules in the Projects Explorer. Double click on the module name that contains the macro code. Copy the macro code from the module and paste it in the Sub WorkBook_Open (). Save the macro-enabled workbook. Open it again. The macro runs and a new worksheet with the report structure is inserted. Print Page Previous Next Advertisements ”;

Excel Macros – Overview

Excel Macros – Overview ”; Previous Next An Excel macro is an action or a set of actions that you can record, give a name, save and run as many times as you want and whenever you want. When you create a macro, you are recording your mouse clicks and keystrokes. When you run a saved macro, the recorded mouse clicks and keystrokes will be executed in the same sequence as they are recorded. Macros help you to save time on repetitive tasks involved in data manipulation and data reports that are required to be done frequently. Macro and VBA You can record and run macros with either Excel commands or from Excel VBA. VBA stands for Visual Basic for Applications and is a simple programming language that is available through Excel Visual Basic Editor (VBE), which is available from the DEVELOPER tab on the Ribbon. When you record a macro, Excel generates VBA code. If you just want to record a macro and run it, there is no need to learn Excel VBA. However, if you want to modify a macro, then you can do it only by modifying the VBA code in the Excel VBA editor. You will learn how to record a simple macro and run it with Excel commands in the chapter – Creating a Simple Macro. You will learn more about macros and about creating and / or modifying macros from Excel VBA editor in the later chapters. Personal Macro Workbook A macro can be saved in the same workbook from where you recorded it. In that case, you can run the macro from that workbook only and hence you should keep it open. Excel gives you an alternative way to store all your macros. It is the personal macro workbook, where you can save your macros, which enables you to run those macros from any workbook. You will learn about Personal Macro Workbook in the chapter – Saving all your Macros in a Single Workbook. Macro Security Macros will be stored as VBA code in Excel. As with the case of any other code, macro code is also susceptible to malicious code that can run when you open a workbook. This is a threat to your computer. Microsoft provided with the Macro Security facility that helps you in protecting your computer from such macro viruses. You will learn more about this in the chapter – Macro Security. Absolute References and Relative References While recording a macro, you can use either absolute references or relative references for the cells on which you are clicking. Absolute references make your macro run at the same cells where you recorded the macro. On the other hand, relative references make your macro run at the active cell. You will learn about these in the chapters – Using Absolute References for a Macro and Using Relative References for a Macro. Macro Code in VBA You can record and run macros from Excel even if you do not know Excel VBA. However, if you have to modify a recorded macro or create a macro by writing VBA code, you should learn Excel VBA. You can refer to the Excel VBA tutorial in this tutorials library for this However, you should know how to view the macro code. You can learn how to access VBA editor in Excel and about the different parts of the VBA editor in the chapter – Excel VBA. You can learn how to view the macro code in Excel VBA editor and you can understand the macro code in the chapter – Understanding Macro Code. Assigning Macros to Objects You can assign a macro to an object such as a shape or a graphic or a control. Then, you can run the macro by clicking on that object. You will learn about this in the chapter – Assigning Macros to Objects. Running Macros Excel provides several ways to run a macro. You can choose the way you want to run a macro. You will learn about these different possible ways of running a macro in the chapter – Running a Macro. Creating a Macro Using VBA Editor If you decide to write the macro code, you can learn it in the chapter – Creating a Macro Using VBA Editor. However, the prerequisite is that you should have Excel VBA knowledge. Editing a Macro You can modify macro code in Excel VBA editor. If you want to make extensive changes, you should have Excel VBA knowledge. But, if you want to make only minor changes to the code or if you want to copy the VBA code from a recorded macro to another macro, you can refer to the chapter – Editing a Macro. You can rename a macro and even delete it. You will learn about this also in the same chapter. User Forms A Form is normally used to collect required information. It will be self-explanatory making the task simple. Excel User Forms created from Excel VBA editor serve the same purpose, providing the familiar options such as text boxes, check boxes, radio buttons, list boxes, combo boxes, scroll bars, etc. as controls. You will learn how to create a User Form and how to use the different controls in the chapter – User Forms. Debugging Macro Code At times, a macro may not run as expected. You might have created the macro or you might be using a macro supplied to you by someone. You can debug the macro code just as you debug any other code to uncover the defects and correct them. You will learn about this in the chapter – Debugging Macro Code. Configuring a Macro to Run on Opening a Workbook You can make your macro run automatically when you open a workbook. You can do this either by creating an Auto_Run macro or by writing VBA code for workbook open event. You will learn this in the chapter – Configuring a Macro to Run on Opening

Assigning Macros to Objects

Excel Macros – Assigning Macros to Objects ”; Previous Next Suppose you have created a macro that you need to execute several times. For example, the macros that you have created for absolute references and relative references. Then, it would be easy for you if you can run the macro using a mouse click. You can accomplish this by assigning the macro to an object such as a shape or a graphic or a control. In this chapter, you will learn how to include an object in your workbook and assign a macro to it. Recall the macro that you created using relative references. The macro arranges the data given in one column into a table to facilitate data analysis. Assigning a Macro to a Shape You can insert a shape in your worksheet that is in a meaningful form with self-explanatory text, which when clicked runs the macro assigned to it. Click the INSERT tab on the Ribbon. Click Shapes in the Illustrations group. Select any of the ready-made shapes that appear in the dropdown list. For example, the Flowchart shape – Preparation, as you are in the process of preparing the data. Draw the shape and format it. Right click on the shape and select Edit Text from the dropdown list. Type text inside the shape – Run Macro. Format the text. Right click on the shape. Select Assign Macro from the dropdown list. The Assign Macro dialog box appears. Click the macro name i.e. RelativeMacro and click OK. The macro is assigned to the shape. Click in the cell where you have to run the macro say B4. Move the cursor (pointer) onto the shape. The cursor (pointer) changes to finger. Now click the shape. The macro will run. Just repeat the mouse clicks to run the macro several times and you are done with the task of arranging the data into a table in a matter of a few seconds. Assigning a Macro to a Graphic You can insert a graphic in the worksheet and assign a macro to it. The graphic can be chosen to visualize your macro. For example, you can have a graphic of table representing that the macro will arrange the data into a table. Click the INSERT tab on the Ribbon. Click Pictures in the Illustrations group. Select a file that contains your graphic. The rest of the steps are the same as those of shape given in the previous section. Assigning a Macro to a Control Inserting a VBA control and assigning a macro to it makes your work look professional. You can insert VBA controls from the Developer tab on the Ribbon. Click the DEVELOPER tab on the Ribbon. Click Insert in the Controls group. Select the Button icon under Form Controls from the dropdown list as shown in screenshot given below − Click the cell on the worksheet where you want to insert the Button control. The Assign Macro dialog box appears. Click the macro name and click OK. The control button with the assigned macro will be inserted. Right click on the button. Click Edit Text. Type – Run Macro. Format Text and resize Button. You can run the macro any number of times by just clicking the Button repeatedly. Using Form Controls is an easy and effective way of interacting with the user. You will learn more about this in the chapter – Interacting with the User. Print Page Previous Next Advertisements ”;

Excel Macros – VBA

Excel Macros – VBA ”; Previous Next Excel stores the macros as Excel VBA (Visual Basic for Applications) code. After recording a macro, you can view the code that is generated, modify it, copy a part of it, etc. You can even write a macro code yourself if you are comfortable with programming in VBA. You will learn how to create a macro, by writing a VBA code, in the chapter – Creating a Macro Using VBA Editor. You will learn how to modify a macro by editing VBA code in the chapter – Editing a Macro. You will learn the Excel VBA features in this chapter. Developer Tab on the Ribbon You can access macro code in VBA from the Developer tab on the Ribbon. If you do not find the Developer tab on the Ribbon, you need to add it as follows − Right click on the Ribbon. Select Customize the Ribbon from the dropdown list. The Excel Options dialog box appears. Select Main Tabs from Customize the Ribbon dropdown list. Check the box – Developer in the Main Tabs list and click OK. The developer tab appears. Developer Commands for Macros You need to know the commands that are for macros under the developer tab. Click the DEVELOPER tab on the Ribbon. The following commands are available in the Code group − Visual Basic Macros Record Macro Use Relative References Macro Security The Visual Basic command is used to open the VBA Editor in Excel and the Macros command is used to view, run and delete the macros. You have already learnt the commands other than VBA Editor in the previous chapters. VBA Editor VBA Editor or VBE is the developer platform for VBA in Excel. Open the workbook – MyFirstMacro.xlsm that you saved earlier in the chapter – Creating a Simple Macro, in this tutorial. You can open the VBE in any of the two ways − Option 1 − Click Visual Basic in the Code group under the Developer tab on the Ribbon. Option 2 − Click Edit in the Macro dialog box that appears when you click VIEW tab → Macros → View Macros VBE appears in a new window. The name of your Excel macro enabled workbook name appears with the prefix – Microsoft Visual Basic for Applications. You will find the following in the VBE − Projects Explorer. Properties. Module window with Code. Projects Explorer Project Explorer is where you find the VBA project names. Under a project, you will find Sheet names and Module names. When you click a module name, the corresponding code appears on the right side in a window. Properties Window The Properties are the parameters for VBA objects. When you have an object such as command button, its properties will appear in the Properties window. Module Window with Code The code of a macro will be stored in a module in VBA. When you select a macro and click Edit, the code of the macro appears in the corresponding module window. Print Page Previous Next Advertisements ”;

Excel Macros – Discussion

Discuss Excel Macros ”; Previous Next An Excel macro is an action or a set of actions that you can record, give a name, save and run as many times as you want and whenever you want. Macros help you to save time on repetitive tasks involved in data manipulation and data reports that are required to be done frequently. Print Page Previous Next Advertisements ”;

Excel Macros – Debugging a Code

Excel Macros – Debugging a Code ”; Previous Next You have learnt that the macro is stored as VBA code in Excel. You have also learnt that you can directly write code to create a macro in VBA editor. However, as with the case with any code, even the macro code can have defects and the macro may not run as you expected. This requires examining the code to find the defects and correct them. The term that is used for this activity in software development is debugging. VBA Debugging VBA editor allows you to pause the execution of the code and perform any required debug task. Following are some of the debugging tasks that you can do. Stepping Through Code Using Breakpoints Backing Up or Moving Forward in Code Not Stepping Through Each Line of Code Querying Anything While Stepping Through Code Halting the Execution These are just some of the tasks that you might perform in VBA”s debugging environment. Stepping Through the Code The first thing that you have to do for debugging is to step through the code while executing it. If you have an idea of which part of the code is probably producing the defect, you can jump to that line of the code. Otherwise, you can execute the code line by line, backing up or moving forward in the code. You can step into the code either from Macro dialog box in your workbook or from the VBA editor itself. Stepping into the code from the workbook To step into the code from the workbook, do the following − Click the VIEW tab on the Ribbon. Click Macros. Select View Macros from the dropdown list. The Macro dialog box appears. Click the macro name. Click the Step into button. VBA editor opens and the macro code appears in the code window. The first line in the macro code will be highlighted in yellow color. Stepping into the code from the VBA editor To step into the code from the VBA editor, do the following − Click the DEVELOPER tab on the Ribbon. Click Visual Basic. The VBA editor opens. Click the module that contains the macro code. The macro code appears in the code window. Click the Debug tab on the Ribbon. Select Step into from the dropdown list. The first line in the macro code will be highlighted. The code is in the debugging mode and the options in the Debug dropdown list will become active. Backing Up or Moving Forward in the Code You can move forward or backward in the code by selecting Step Over or Step Out. Not Stepping Through Each Line of Code You can avoid stepping through each line code, if you identify a potential part of the code that needs to be discussed, by selecting Run to Cursor. Using Breakpoints Alternatively, you can set breakpoints at specific lines of code and execute the code, observing the results at each breakpoint. You can toggle a breakpoint and clear all breakpoints if and when required. Using Watch You can add a watch while debugging, to evaluate an expression and stop the execution when a variable attains a specific value. This means that you configure a watch expression, which will be monitored until it is true and then the macro will halt and leave you in break mode. VBA provides you with several watch types to select from, in order to accomplish what you are looking for. Halting the Execution During debugging, at any point of time, if you have found a clue on what is going wrong, you can halt the execution to decipher further. If you are an experienced developer, the debugging terminology is familiar to you and VBA editor debugging options make your life simple. Even otherwise, it will not take much time to master this skill if you have learnt VBA and understand the code. Print Page Previous Next Advertisements ”;

Excel Macros – Quick Guide

Excel Macros – Quick Guide ”; Previous Next Excel Macros – Overview An Excel macro is an action or a set of actions that you can record, give a name, save and run as many times as you want and whenever you want. When you create a macro, you are recording your mouse clicks and keystrokes. When you run a saved macro, the recorded mouse clicks and keystrokes will be executed in the same sequence as they are recorded. Macros help you to save time on repetitive tasks involved in data manipulation and data reports that are required to be done frequently. Macro and VBA You can record and run macros with either Excel commands or from Excel VBA. VBA stands for Visual Basic for Applications and is a simple programming language that is available through Excel Visual Basic Editor (VBE), which is available from the DEVELOPER tab on the Ribbon. When you record a macro, Excel generates VBA code. If you just want to record a macro and run it, there is no need to learn Excel VBA. However, if you want to modify a macro, then you can do it only by modifying the VBA code in the Excel VBA editor. You will learn how to record a simple macro and run it with Excel commands in the chapter – Creating a Simple Macro. You will learn more about macros and about creating and / or modifying macros from Excel VBA editor in the later chapters. Personal Macro Workbook A macro can be saved in the same workbook from where you recorded it. In that case, you can run the macro from that workbook only and hence you should keep it open. Excel gives you an alternative way to store all your macros. It is the personal macro workbook, where you can save your macros, which enables you to run those macros from any workbook. You will learn about Personal Macro Workbook in the chapter – Saving all your Macros in a Single Workbook. Macro Security Macros will be stored as VBA code in Excel. As with the case of any other code, macro code is also susceptible to malicious code that can run when you open a workbook. This is a threat to your computer. Microsoft provided with the Macro Security facility that helps you in protecting your computer from such macro viruses. You will learn more about this in the chapter – Macro Security. Absolute References and Relative References While recording a macro, you can use either absolute references or relative references for the cells on which you are clicking. Absolute references make your macro run at the same cells where you recorded the macro. On the other hand, relative references make your macro run at the active cell. You will learn about these in the chapters – Using Absolute References for a Macro and Using Relative References for a Macro. Macro Code in VBA You can record and run macros from Excel even if you do not know Excel VBA. However, if you have to modify a recorded macro or create a macro by writing VBA code, you should learn Excel VBA. You can refer to the Excel VBA tutorial in this tutorials library for this However, you should know how to view the macro code. You can learn how to access VBA editor in Excel and about the different parts of the VBA editor in the chapter – Excel VBA. You can learn how to view the macro code in Excel VBA editor and you can understand the macro code in the chapter – Understanding Macro Code. Assigning Macros to Objects You can assign a macro to an object such as a shape or a graphic or a control. Then, you can run the macro by clicking on that object. You will learn about this in the chapter – Assigning Macros to Objects. Running Macros Excel provides several ways to run a macro. You can choose the way you want to run a macro. You will learn about these different possible ways of running a macro in the chapter – Running a Macro. Creating a Macro Using VBA Editor If you decide to write the macro code, you can learn it in the chapter – Creating a Macro Using VBA Editor. However, the prerequisite is that you should have Excel VBA knowledge. Editing a Macro You can modify macro code in Excel VBA editor. If you want to make extensive changes, you should have Excel VBA knowledge. But, if you want to make only minor changes to the code or if you want to copy the VBA code from a recorded macro to another macro, you can refer to the chapter – Editing a Macro. You can rename a macro and even delete it. You will learn about this also in the same chapter. User Forms A Form is normally used to collect required information. It will be self-explanatory making the task simple. Excel User Forms created from Excel VBA editor serve the same purpose, providing the familiar options such as text boxes, check boxes, radio buttons, list boxes, combo boxes, scroll bars, etc. as controls. You will learn how to create a User Form and how to use the different controls in the chapter – User Forms. Debugging Macro Code At times, a macro may not run as expected. You might have created the macro or you might be using a macro supplied to you by someone. You can debug the macro code just as you debug any other code to uncover the defects and correct them. You will learn about this in the chapter – Debugging Macro Code. Configuring a Macro to Run on Opening a Workbook You can make your macro run automatically when you open a workbook. You can do this either by creating an Auto_Run macro or by writing VBA code for workbook open event. You will learn this in the chapter – Configuring a