Microsoft Excel 2007 – Level 2 Chapter 7 AUTOMATING REPETITIVE TASKS AND CUSTOMIZING EXCEL
Performance Objectives Record and run a macro Save a workbook as a macro-enabled workbook Create a macro that is run with shortcut keys Change the macro security settings Edit and delete a macro Save a macro to the Personal Macro Workbook for use in all workbooks Create and delete a custom fill series Pin and unpin a frequently-used file to the Recent Documents list Add and remove buttons for frequently-used commands to the Quick Access toolbar Hide the ribbon to increase space in the work area Customize the work area to hide gridlines and column and row headers Create a custom workbook theme Create and use a template
Creating a Macro A macro is a named series of instructions that can be recalled by selecting a menu item pressing a particular key combination Each macro must have a unique name must begin with a letter can be a combination of letters, numbers, and underscore characters with no spaces may not be the same as a cell reference Macro instructions are stored as Visual Basic (VBA) instructions either with the current workbook or available to all other workbooks
Top button views existing macros Bottom button opens this list The Macro Recorder Turn ON the Macro Recorder to record the series of instructions The Macro Recorder works much like a tape recorder to record every keystroke and mouse click Top button views existing macros Click Bottom button opens this list OR click the Macro Recorder button in the left side of the Status bar
Recording a Macro View tab, Macros button, Record Macro Record Macro dialog box Enter a descriptive name Enter the letter to press with the Ctrl key to execute the macro -Case sensitive Select where the macro is to be stored Enter a description Click
Recording a Macro…/2 With the Macro Recorder ON, Type information, press the Enter key, click menu items, use shortcut keys – all keystrokes and most mouse clicks will be recorded Click to Stop Recording HINTS Save before running a macro. Before starting the macro, consider if the location of the active cell is a factor.
Must save the workbook as ‘macro-enabled’ Saving the Macro Must save the workbook as ‘macro-enabled’ In Save As dialog box OR Click Saving as type ‘Excel Macro-Enabled Workbook’ creates a .xlsm workbook which includes Visual Basic (VBA) code for the macro
Running (Playing) a Macro View tab, Macros button (top button) Double-click the macro OR Select the macro, then click Run
Running a Macro…/2 If a keyboard shortcut has been assigned to the macro, the macro can be run by simply pressing its shortcut key combination Click to edit the shortcut key and the description
Enable Macros in a Workbook Excel can place a Security Warning above the worksheet when opening a workbook that contains macros Click Read carefully, click ‘Enable this content’, and click OK Only enable the content when the workbook is from a trusted source
Changing Macro Security Settings Click Choose desired settings
Changing Macro Security Settings/2 Macro Security when opening workbooks … Macro Setting Description Disable all macros without notification All macros are disabled; security alerts will not appear Disable all macros with notification All macros are disabled; security alert appears with the option to enable content if you trust the source of the file. (Default setting) Disable all macros except digitally signed macros All macros not digitally signed are disabled; security alerts do not appear. If digitally signed by a publisher in the Trusted Sources list, the macro is allowed to run. If digitally signed, but not in the list, a security warning will appear. Enable all macros (not recommended) All macros are allowed; security alerts do not appear.
Editing a Macro View tab, Macros button Select the macro Click to edit the macro using the Visual Basic Editor Often easier to delete the macro and re-record it
executable lines of code Editing a Macro…/2 Comment lines Beginning of macro Statements are executable lines of code End of macro
Saving a Macro to the Personal Macro Workbook Macros are stored by default in the current workbook, and are available to all other open workbooks as long as the current workbook is open. Macros stored in the Personal Macro Workbook are available whenever Excel is open on the current computer. When creating the macro, click the down arrow and choose Personal Macro Workbook
Deleting a Macro View tab, Macros button (top button) Select the macro Click to delete the selected macro
Creating a Custom List Series Use to fill a series of cells with the Fill handle or to create a list with an unusual sort order Click
Creating a Custom List Series /2 Import the list 1. Type entries into a worksheet 2. Select the range containing the entries 3. Open Excel Options, Edit Custom Lists 4. Click Import 5. Click OK
Creating a Custom List Series /3 Add a list by typing it in 1. Open Excel Options, Edit Custom Lists 2. Select NEW LIST 3. Type the list here, one entry per line 4. Click Add 5. Click OK
Deleting a Custom List 1. Open Excel Options, Edit Custom Lists 2. Select the list 3. Click Delete 4. Click OK A warning message is displayed
Pinning Workbooks to the Recent Documents List Click the Office button to see the Recent Documents list Click the pin of the frequently-used workbook Click again to unpin it
Customizing the Quick Access Toolbar Click Toggle on or off Click to re-order, add, or delete commands
Use to provide more Excel work area space Minimizing the Ribbon Use to provide more Excel work area space To toggle the ribbon on or off Double-click a tab OR Click the ‘Customize Quick Access Toolbar’ button and click ‘Minimize the Ribbon’ OR Press Ctrl + F1
Creating Custom Themes A Theme is Page Layout tab … a combination of theme colors, theme fonts, and theme effects … stored in the Themes drop-down gallery
Modifying Theme Colors Page Layout tab, Theme Colors Change Colors, Name, and Save Click to create your own
Modifying Theme Fonts Page Layout tab, Fonts Choose Heading font and Body font Click to create custom font Type a Name and click Save
Applying Custom Theme Colors & Fonts Page Layout tab, Colors Custom Color set appears at top of Colors list Custom Font set appears at top of Fonts list
Applying Theme Effects Page Layout tab, Effects Theme effects are sets of lines and fill effects Although you cannot create your own set of theme effects, you can choose the one that you want to use in your own document theme
Saving a Workbook Theme Page Layout tab, Themes After setting the colors, fonts, and effects, click Save Current Theme… Enter Name and click Save
Resetting to Template Theme Page Layout tab, Themes To reset the theme for the current document, click
Deleting Custom Themes Page Layout tab, Themes To delete a custom theme, right-click the theme and click
Saving a Workbook as a Template A template contains standard text, formulas, and formatting for non-changing cells and formatting for cells that will change 1. Create a workbook that contains all the standard data, formulas, and formatting 2. Clear the data from cells that will have variable information, but leave formatting 3. Save As the workbook, changing the Save as type to Excel Template (.xlst) Examples of templates: invoice, purchase order, expense form, time card
Using a Custom Template With the prepared workbook open, click Not this button then click Double-click desired template
Deleting a Custom Template Click Not this button then click Right-click desired template and click Delete
Record Macro button in the Status bar Features Summary How do you record a macro? Record Macro button in the Status bar OR Click
Features Summary How do you run a macro? OR View tab, Macros button Double-click the macro Select the macro, then click Run OR Press the macro’s shortcut keys
Features Summary How do you delete a macro? View tab, Macros button Select the macro Click to delete the selected macro
Features Summary How do you view or change the Macro Security options? Click the Office button, Excel Options Click Trust Center in the sidebar, Click ‘Trust Center Settings’ – Click Macro Settings in the sidebar
Features Summary How can you open the Custom Lists dialog box? Open Excel Options and click Edit Custom Lists
Click NEW LIST, click Add and type in the entries Features Summary After opening the Custom Lists dialog box, how do you create a custom list? Click NEW LIST, click Add and type in the entries OR Import the list from a range in a worksheet
Features Summary What must be changed to create a custom theme set? Theme colors, Theme fonts, and Theme effects
Type name and click Save Features Summary How can you save your custom theme set? Page Layout tab, Themes After setting the colors, fonts, and effects, click Save Current Theme… Type name and click Save
Right-click custom color or font set and choose Edit… Features Summary How do you change a custom theme after it has been saved? Click Page Layout tab, Colors OR Page Layout tab, Fonts Right-click custom color or font set and choose Edit…
cells to be filled in, and Save AS the Features Summary How do you create a template? Create a workbook with preset text, formulas, and formatting, format and clear cells to be filled in, and Save AS the workbook as a template
IMPORTING, EXPORTING, AND DISTRIBUTING DATA Coming Next Chapter 8 IMPORTING, EXPORTING, AND DISTRIBUTING DATA