Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft Excel 2013 ®® Tutorial 7: Developing an Excel Application.

Similar presentations


Presentation on theme: "Microsoft Excel 2013 ®® Tutorial 7: Developing an Excel Application."— Presentation transcript:

1 Microsoft Excel 2013 ®® Tutorial 7: Developing an Excel Application

2 XP New Perspectives on Microsoft Excel Objectives Create an application Create, edit, and delete defined names for cells and ranges Paste a list of defined names as documentation Use defined names in formulas Add defined names to existing formulas

3 XP New Perspectives on Microsoft Excel Objectives Create validation rules for data entry Protect the contents of worksheets and workbooks Add, edit, and delete comments

4 XP New Perspectives on Microsoft Excel Objectives Learn about macro viruses and Excel security features Add the DEVELOPER tab to the ribbon Create and run a macro Edit a macro using the Visual Basic Editor Assign a macro to a keyboard shortcut and a button Save and open a workbook in macro-enabled format

5 XP New Perspectives on Microsoft Excel Visual Overview: Excel Application and Defined Names

6 XP New Perspectives on Microsoft Excel Visual Overview: Excel Application and Defined Names

7 XP Planning an Excel Application An Excel application is a spreadsheet written or tailored to meet specific needs Planning includes designing how the worksheet(s) will be organized; you can: – Enter and edit data (setting where and what types of data can be entered) – Store data after it has been entered – Use formulas to manipulate and perform calculations on data – Display outputs, such as reports and charts New Perspectives on Microsoft Excel 20137

8 XP Naming Cells and Ranges Cell and range references do not indicate what data is stored in those cells You can use a defined name to assign a meaningful, descriptive name to a cell or range A defined name enables you to quickly navigate within a workbook to the cell or range with the defined name You can use defined names to create more descriptive formulas New Perspectives on Microsoft Excel 20138

9 XP Naming Cells and Ranges Rules for naming cells or ranges – Must begin with a letter or _ – Can include letters and numbers as well as periods and underscores, but not other symbols or spaces – Use an underscore between the words or capitalize the first letter of each word – Cannot be a valid cell address, function name, or reserved word – Can include as many as 255 characters – The name is not case sensitive New Perspectives on Microsoft Excel 20139

10 XP Naming Cells and Ranges Using the Name Box to Create Defined Names – The Name box is a quick way to create a defined name for a selected cell or range New Perspectives on Microsoft Excel

11 XP Naming Cells and Ranges Selecting Cells and Ranges by Their Defined Names – The Name box displays all of the defined names in a workbook – Click a name in the Name box list to quickly select the cell or range referenced by that name New Perspectives on Microsoft Excel

12 XP Naming Cells and Ranges Creating Defined Names by Selection – Quickly define names without typing them if the data is organized as a structured range of data with labels in the first or last column, or in the top or bottom row – Defined names are based on the row or column labels New Perspectives on Microsoft Excel

13 XP Naming Cells and Ranges Editing and Deleting Defined Names – The Name Manager dialog box lists all of the names currently defined in the workbook, including Excel table names – In addition to the name, it identifies the current value for that name as well as the worksheet and cell or range it references – Use the Name Manager dialog box to create a new name, edit or delete existing names, and filter the list of names New Perspectives on Microsoft Excel

14 XP Naming Cells and Ranges New Perspectives on Microsoft Excel

15 XP Naming Cells and Ranges Using the Paste Names Command – When a workbook contains many defined names, it can be helpful to list all of the defined names and their corresponding cell addresses in the workbook’s documentation – You can generate a list of names using the Paste Names command – If you edit a defined name or add a new defined name, the list of defined names and their addresses in the Documentation worksheet is not updated; you must paste the list again to update New Perspectives on Microsoft Excel

16 XP Using Defined Names in Formulas You can create more descriptive formulas by using defined names instead of cell or range references in formulas Range references in formulas are not updated with their defined names; if you enter a range reference in a formula, its corresponding defined name does not automatically replace the range reference in the formula New Perspectives on Microsoft Excel

17 XP Using Defined Names in Formulas Defined names make formulas simpler to enter and understand To use a defined name in a formula: – Enter the formula as usual – As you type a defined name in a formula, the Formula AutoComplete box appears, listing functions and defined names that begin with the letters you typed – You can double-click the name you want in the Formula AutoComplete box or press the Tab key New Perspectives on Microsoft Excel

18 XP Using Defined Names in Formulas Adding Defined Names to Existing Formulas – You might name cells after creating formulas in the worksheet or you might not use the names – Because defined names are not automatically substituted for the cell addresses in a formula, you can replace cell addresses in existing formulas in the worksheet with their defined names to make the formulas more understandable New Perspectives on Microsoft Excel

19 XP New Perspectives on Microsoft Excel Visual Overview: Data Validation and Protection

20 XP New Perspectives on Microsoft Excel Visual Overview: Data Validation and Protection

21 XP Validating Data Entry To ensure that correct data is entered and stored in a worksheet, you can use data validation Each validation rule defines criteria for the data that can be entered and stored in a cell or range You can add input and error alert messages for the user to that cell or range You specify the validation criteria, the input message, and the error alert for the active cell in the Data Validation dialog box New Perspectives on Microsoft Excel

22 XP Validating Data Entry New Perspectives on Microsoft Excel Specifying Validation Criteria – When creating a validation rule, you specify the type of data that is allowed as a list or range of acceptable values (called validation criteria)

23 XP Validating Data Entry Creating an Error Alert Style and Message – An error alert determines what happens after a user tries to make an invalid entry in a cell that has a validation rule defined – The three error alert styles are: Stop: Prevents the entry from being stored in the cell Warning: Prevents the entry from being stored in the cell unless the user overrides the rejection and decides to continue using the data Information: Accepts the data value entered, but allows the user to choose to cancel the data entry New Perspectives on Microsoft Excel

24 XP Validating Data Entry New Perspectives on Microsoft Excel

25 XP Validating Data Entry Creating an Input Message – One way to reduce the chance of a data-entry error is to display an input message when a user makes the cell active – An input message provides additional information about the type of data allowed for that cell – Input messages appear as ScreenTips next to the cell when the cell is selected – Can add an input message to a cell even if you don’t set up a rule to validate the data in that cell New Perspectives on Microsoft Excel

26 XP Validating Data Entry New Perspectives on Microsoft Excel

27 XP Validating Data Entry Creating a List Validation Rule – Use the data validation feature to restrict a cell to accept only entries that are on a list you create – Create the list of valid entries in the Data Validation dialog box or use a list of valid entries in a single column or row – Once you create a list validation rule for a cell, a list box with the possible values appears when the user selects the cell New Perspectives on Microsoft Excel

28 XP Validating Data Entry New Perspectives on Microsoft Excel

29 XP Validating Data Entry Testing Data Validation Rules – Test validation rules by entering incorrect values that violate the validation rules – The only way an error occurs in cells that have a list validation is if an incorrect entry is typed or pasted in the cell – Entering invalid data will ensure that validation rules work as expected New Perspectives on Microsoft Excel

30 XP Protecting a Worksheet and a Workbook Another way to minimize data-entry errors is to limit access to certain parts of the workbook Worksheet protection prevents users from changing cell contents, such as editing formulas in a worksheet Workbook protection also prevents users from changing the workbook’s organization, such as inserting or deleting worksheets in the workbook You can keep users from viewing the formulas used in the workbook New Perspectives on Microsoft Excel

31 XP Protecting a Worksheet and a Workbook Locking and Unlocking Cells – Every cell in a workbook has a locked property that determines whether changes can be made to that cell – The locked property has no impact as long as the worksheet is unprotected – After you protect a worksheet, the locked property controls whether the cell can be edited – Unlock a cell by turning off the locked property – By default, the locked property is turned on for each cell, and worksheet protection is turned off New Perspectives on Microsoft Excel

32 XP Protecting a Worksheet and a Workbook Locking and Unlocking Cells (continued) – Unless you unlock cells in a worksheet before protecting the worksheet, all of the cells in the worksheet will be locked, and you won’t be able to make any changes – Usually, you will protect the worksheet but leave some cells unlocked First, turn off the locked property of cells in which data can be entered Then, you protect the worksheet to activate the locked property for the remaining cells New Perspectives on Microsoft Excel

33 XP Protecting a Worksheet and a Workbook New Perspectives on Microsoft Excel

34 XP Protecting a Worksheet and a Workbook Protecting a Worksheet – When you set up worksheet protection, you specify which actions are still available to users in the protected worksheet – You can limit the user to selecting only unlocked cells, or allow the user to select any cell in the worksheet; these choices remain active as long as the worksheet is protected – A protected worksheet can always be unprotected – You can add a password that must be entered to turn off the protection New Perspectives on Microsoft Excel

35 XP Protecting a Worksheet and a Workbook New Perspectives on Microsoft Excel

36 XP Protecting a Worksheet and a Workbook Protecting a Workbook – Worksheet protection applies only to the contents of a worksheet, not to the worksheet itself – To keep a worksheet from being modified, you need to protect the workbook – You can protect both the structure and the windows of a workbook – Protecting the structure prevents users from renaming, deleting, hiding, or inserting worksheets New Perspectives on Microsoft Excel

37 XP Protecting a Worksheet and a Workbook Unprotecting a Worksheet and a Workbook – You can turn off worksheet protection at any time – You must unprotect a worksheet to edit its contents – You can unprotect the workbook – If you need to insert a new worksheet or rename an existing worksheet, you can unprotect the protected workbook, make the changes to the structure, and then reapply workbook protection New Perspectives on Microsoft Excel

38 XP Inserting Comments Comments are often used in workbooks to: – Explain the contents of a particular cell, such as a complex formula – Provide instructions to users – Share ideas and notes from several users collaborating on a project If you collaborate on a workbook, the top of the comment boxes would show the name of each user who created that comment New Perspectives on Microsoft Excel

39 XP Inserting Comments A small red triangle appears in the upper-right corner of a cell with a comment The comment box appears when you point to a cell with a comment New Perspectives on Microsoft Excel

40 XP New Perspectives on Microsoft Excel Visual Overview: Working with Macros

41 XP New Perspectives on Microsoft Excel Visual Overview: Working with Macros

42 XP Automating Tasks with Macros Macros automate any task you perform repeatedly Macros perform repetitive tasks consistently and faster than you can. After the macro is created and tested, you can be assured the tasks are done exactly the same way each time To create and run macros, you need to use the DEVELOPER tab New Perspectives on Microsoft Excel

43 XP Automating Tasks with Macros The DEVELOPER tab has five groups: – One for code – One for add-ins – One for controls – One for XML – One to modify document controls New Perspectives on Microsoft Excel

44 XP Protecting Against Macro Viruses A virus is a computer program designed to copy itself into other programs with the intention of causing mischief or harm Macro viruses use a program’s own macro programming language to distribute the virus – Can be destructive – Can modify or delete files that may not be recoverable New Perspectives on Microsoft Excel

45 XP Protecting Against Macro Viruses Macro Security Settings – Control what Excel will do about macros in a workbook when you open that workbook New Perspectives on Microsoft Excel

46 XP Protecting Against Macro Viruses Macro Security Settings (continued) – Set macro security in the Trust Center – The Trust Center is a central location for all of the security settings in Office – By default, all potentially dangerous content is blocked without warning – If content is blocked, the Message Bar (also called the trust bar) opens below the ribbon, notifying you that some content was disabled – You can click the Message Bar to enable content New Perspectives on Microsoft Excel

47 XP Protecting Against Macro Viruses New Perspectives on Microsoft Excel

48 XP Recording a Macro You can create an Excel macro in one of two ways: – Use the macro recorder to record keystrokes and mouse actions as you perform them – Enter a series of commands in the Visual Basic for Applications (VBA) programming language New Perspectives on Microsoft Excel

49 XP Recording a Macro The macro recorder can record only those actions you perform with the keyboard or mouse The macro recorder is a good choice for creating simple macros For more sophisticated macros, you might need to write VBA code directly in the Visual Basic Editor (VBE) New Perspectives on Microsoft Excel

50 XP Recording a Macro By default, the macro is stored in the current workbook (only available with that workbook) Another option is to store the macro in the Personal Macro workbook, a hidden workbook named PERSONAL.xlsb that opens whenever you start Excel – Stores commonly used macros – Is most convenient for users on stand-alone computers Can store the macro in a new workbook New Perspectives on Microsoft Excel

51 XP Recording a Macro New Perspectives on Microsoft Excel

52 XP Running a Macro After you record a macro, you should run it to test whether it works as intended Running a macro means Excel performs each of the steps in the same order as when it was recorded To run the macro you created, you can either use the shortcut key you specified or select the macro in the Macro dialog box New Perspectives on Microsoft Excel

53 XP Running a Macro The Macro dialog box lists all of the macros in the open workbooks From this dialog box, you can: – Select and run a macro – Edit the macro with VBA – Run the macro one step at a time so you can determine in which step an error occurs – Delete the macro New Perspectives on Microsoft Excel

54 XP Running a Macro New Perspectives on Microsoft Excel

55 XP Creating the TransferData Macro Fixing Macro Errors – If a macro does not work correctly, you can fix it – You have the following options to fix a macro: Rerecord the macro using the same macro name Delete the recorded macro, and then record the macro again Run the macro one step at a time to locate the problem, and then use one of the previous methods to correct the problem New Perspectives on Microsoft Excel

56 XP Working with the Visual Basic Editor To view the code of a macro, open the Visual Basic Editor (VBE)—allows you to view, debug, edit, and manage VBA code The VBE consists of several components, including: – The Code window that contains the VBA code – A menu bar with menus of commands you use to edit, debug, and run VBA statements You can access the Visual Basic Editor through the Macro dialog box or the Visual Basic button in the Code group on the DEVELOPER tab New Perspectives on Microsoft Excel

57 XP Working with the Visual Basic Editor New Perspectives on Microsoft Excel

58 XP Working with the Visual Basic Editor Understanding the Structure of Macros – In VBA, macros are called sub procedures – Each sub procedure begins with the keyword Sub followed by the name of the sub procedure and a set of parentheses – Sub procedures are organized into modules New Perspectives on Microsoft Excel

59 XP Working with the Visual Basic Editor Editing a Macro Using the Visual Basic Editor – The Visual Basic Editor provides tools to assist you in writing error-free code – As you type a command, the editor will provide pop-up windows and text to help you insert the correct code New Perspectives on Microsoft Excel

60 XP Creating Macro Buttons Another way to run a macro is to assign it to a button placed directly in the worksheet Macro buttons are often a better way to run macros than shortcut keys Clicking a button (with a descriptive label) is often more intuitive and simpler for users than trying to remember different combinations of keystrokes New Perspectives on Microsoft Excel

61 XP Creating Macro Buttons New Perspectives on Microsoft Excel

62 XP Saving a Workbook with Macros When you save a workbook that contains macros, a dialog box opens indicating that the workbook you are Saving a Workbook with Macros e trying to save contains features that cannot be saved in a macro-free workbook The default Excel workbook does not allow macros to be stored as part of the file and has the.xlsx file extension A macro-enabled workbook has the.xlsm file extension New Perspectives on Microsoft Excel

63 XP Saving a Workbook with Macros In the Macro warning dialog box: – Click the Yes button if you want to save the workbook without the macros; the macros you created will be lost – Click the No button if you want to save the workbook with the macros; then save the workbook as a new file—one that allows macros to be saved as part of the file New Perspectives on Microsoft Excel

64 XP Opening a Workbook with Macros When you open a file with macros, Excel checks the opening workbook to see if it contains any macros New Perspectives on Microsoft Excel

65 XP Removing a Tab from the Ribbon If you decide you don’t want a tab displayed on the ribbon, you can remove it To remove the DEVELOPER tab from the ribbon: – Right-click any tab on the ribbon, and then click Customize the Ribbon – In the Main Tabs box, click the Developer check box to remove the checkmark – Click the OK button New Perspectives on Microsoft Excel


Download ppt "Microsoft Excel 2013 ®® Tutorial 7: Developing an Excel Application."

Similar presentations


Ads by Google