1 / 15

CA202 Spreadsheet Application

Learn how to create, modify, and run macros in Excel to automate processes effectively. Discover how to create toolbars and menus for easy macro access, and run macros automatically when opening a workbook.

sjandreau
Download Presentation

CA202 Spreadsheet Application

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CA202Spreadsheet Application Automating Repetitive Tasks with Macros Lecture # 12 Dammam Community College

  2. Objectives In this chapter you will learn to: ✔ Open and run macros. ✔ Create and modify macros. ✔ Create toolbars and menus to hold macros. ✔ Run a macro when a workbook is opened.

  3. Introducing Macros • Some sequences involve many steps and take time to accomplish by hand. • Rather than doing by hand every time, you can create a macro, to do repeated things. • Alt+F8 to bring Macro dialog box or click Tools  Macro  Macros…

  4. Introducing Macros • If you have trouble running macros, you can click Tools  Macro  Security… • Click on Medium option button and click OK

  5. To See How Macro Works • To see how the macro works, you can open the Macro dialog box, click the name of the macro you want to examine, and then click Step Into.

  6. To See How Macro Works • To execute an instruction, you press F8. The highlight moves to the next instruction, and your worksheet changes to reflect the action ExerciseMacrosView

  7. Creating and Modifying Macros • Once you have planned your process, you can create a macro by Clicking: • Tools  Macro Record New Macro. • Type the name of macro • click OK. • The Stop Recording toolbar appears. ExerciseRecordMacros

  8. Creating a Toolbar to Hold Macros • Run a macro from toolbar makes your worksheets much easier to use, especially for people with less experience. • To create a toolbar Click Tools  Customize.

  9. Creating a Toolbar to Hold Macros • Once you have created the new toolbar, you can assign your macros to it. • Click Commands tab • Two items will appear in the Commands list: • Custom Menu Item. • Custom Button. • To add a button to your new toolbar, drag the Custom Button item to the toolbar.

  10. Creating a Toolbar to Hold Macros • Right Click on toolbar and assign the Macro

  11. Creating a Toolbar to Hold Macros • To Delete a toolbar click Tool  Customize • Click on Toolbar tab • Select the Toolbar • Click on Delete • Click OK to confirm deletion

  12. Creating a Toolbar to Hold Macros • You can change the image. • Right Click on Image • Select Change Image Button

  13. Creating a Menu to Hold Macros • Click Tool  Customize • Click Command  New Menu • Drag New Menu to desired spot • Right click and change the Name of menu ExerciseCustomMenu

  14. Running a Macro When a Workbook Is Opened • You can run your macro by hand, or from a toolbar button, or a menu. • You can run a macro automatically even when you are opening a work book. • Whenever Excel finds a macro with a name starting with Auto_ (Auto followed by an underscore), it runs the macro when the workbook to which it is attached is opened. ExerciseRunOnOpen

  15. Chapter 12 Key Points • Macros are handy tools you can use to perform repetitive tasks quickly, such as inserting blocks of text. • You don’t have to be a programmer to use macros; you can record your actions and have Excel save them as a macro. • Always keep control over whether you want to enable macros in a particular workbook by setting your security level to Medium or High. • If you’re curious about what a macro looks like, you can display it in the Visual Basic Editor. If you know a little VBA, or if you just want to experiment, feel free to modify the macro code and see what happens. • You can create toolbar buttons or menu items that, when clicked, will run a macro. • Starting a macro name with Auto_ tells Excel to run the macro when it opens the workbook to which the macro is attached.

More Related