chapter 10 troubleshooting workbooks and creating …cs385.cs.ua.edu/chapter.10.pdf · chapter...

57
Troubleshooting Workbooks and Creating Excel Applications Chapter 10

Upload: phamngoc

Post on 23-Mar-2018

224 views

Category:

Documents


5 download

TRANSCRIPT

Troubleshooting Workbooks and Creating Excel Applications

Chapter 10

Chapter Introduction

• Information system

– Collects, organizes, and processes data

– Communicates and distributes coordinated results

• Decision support system (DSS)

– Helps managers model business scenarios, especially through what-if analysis

• Minimizing data-entry errors in Excel workbooks

• Documenting workbooks and troubleshooting worksheet errors

Succeeding in Business with Microsoft Excel 2010 2

Chapter Introduction (continued)

• Automating tasks to further enhance usefulness and reliability of workbooks

• Tools covered in this chapter: Comments, Data Validation, Formula Auditing, Macro recorder, Visual Basic Editor, Worksheet and workbook protection

To go to Level 1, click here To go to Level 2, click here To go to Level 3, click here

Succeeding in Business with Microsoft Excel 2010 3

Tools Covered in this Chapter

• Comments

• Data Validation

• Formula Auditing

• Macro Recorder

• Visual Basic Editor

• Worksheet and workbook protection

Succeeding in Business with Microsoft Excel 2010 4

Level 1 Objectives: Preparing Error-Free Workbooks

• Plan an Excel application

• Control data-entry errors

• Protect workbooks

• Document workbooks

Succeeding in Business with Microsoft Excel 2010 5

Planning an Excel Application

• Workbooks designed so others can use them

• Usually a decision support system – Support decisions by allowing what-if analysis and

other types of data analysis

• Typically provide an easy-to-use interface – Custom buttons

– Clearly written documentation

– Instructions for entering data and performing calculations

Succeeding in Business with Microsoft Excel 2010 6 Level 1 home

Planning an Excel Application

Succeeding in Business with Microsoft Excel 2010 7 Level 1 home

Controlling Data-Entry Errors

Data validation

tool

• Creates rules that define what data is valid

in a particular cell

Validation rule • Specifies type of data that is appropriate

• Specifies range of acceptable values

Input message • Identifies kind of data user should enter

Error alert •Displays a message of varying severity

Succeeding in Business with Microsoft Excel 2010 8 Level 1 home

Validating Data Using the Data Validation Tool

1. Set up the data validation rule

2. Create the input message

3. Specify the error alert style and message

Succeeding in Business with Microsoft Excel 2010 9 Level 1 home

Setting Up a Data Validation Rule

Succeeding in Business with Microsoft Excel 2010 10 Level 1 home

Setting Up a Data Validation Rule

Succeeding in Business with Microsoft Excel 2010 11 Level 1 home

Setting Up a Data Validation Rule

Succeeding in Business with Microsoft Excel 2010 12 Level 1 home

Setting Up a Data Validation Rule

Succeeding in Business with Microsoft Excel 2010 13 Level 1 home

Creating an Input Message

Succeeding in Business with Microsoft Excel 2010 14 Level 1 home

Specifying an Alert Style and Message

Succeeding in Business with Microsoft Excel 2010 15 Level 1 home

Specifying an Alert Style and Message

Succeeding in Business with Microsoft Excel 2010 16 Level 1 home

Circling Invalid Data

Succeeding in Business with Microsoft Excel 2010 17 Level 1 home

This tool finds and

marks cells containing

data that do not meet

validation criteria

Protecting Workbooks

• Ways to protect workbooks

– Lock cells so that users cannot change their contents

– Hide cells so that users cannot see them

– Restrict actions users can perform on specified portions of specified worksheets

– Prevent a worksheet from being deleted from a workbook

• Select appropriate level of protection (worksheet, workbook, file)

Succeeding in Business with Microsoft Excel 2010 18 Level 1 home

Locking and Unlocking Cells

• To allow users to change contents of unlocked cell, but not the contents of locked cells:

– Unlock cells you want users to change access (Locked property of a cell)

– Protect the worksheet to engage the Locked property of the cells

Succeeding in Business with Microsoft Excel 2010 19 Level 1 home

Locking and Unlocking Cells

Succeeding in Business with Microsoft Excel 2010 20 Level 1 home

Protecting a Worksheet

• Users cannot change content of locked cells

• Specify what users can do in the worksheet (format, enter data)

• Can specify passwords that users enter a case-sensitive password before they remove protection

Succeeding in Business with Microsoft Excel 2010 21 Level 1 home

Protecting a Worksheet

Succeeding in Business with Microsoft Excel 2010 22 Level 1 home

Hiding and Displaying Rows and Columns

Succeeding in Business with Microsoft Excel 2010 23 Level 1 home

Protecting a Workbook

• To prohibit users from adding, renaming, or deleting worksheets in the workbook

• Secure workbook structure or its windows – Structure (cannot insert, delete, or rename

worksheets)

– Windows (Excel windows are same size and position each time workbook opens)

• Can specify that users enter a case-sensitive password before they remove protection

Succeeding in Business with Microsoft Excel 2010 24 Level 1 home

Documenting Workbooks

• Documentation

– All records that describe how and why a system has been developed and how it should be used

– Tremendous time-saver

– Can include within a workbook or print workbook information (documentation worksheet or workbook’s formulas)

Succeeding in Business with Microsoft Excel 2010 25 Level 1 home

Types of Documentation for Excel Applications

• Basic information (workbook author, date of creation, purpose)

• Step-by-step instructions for entering data and performing calculations

• Notes or comments that identify the source of data

• Notes or comments that define terms, explain calculations, describe assumptions

Succeeding in Business with Microsoft Excel 2010 26 Level 1 home

Providing a Thorough Documentation Worksheet

Succeeding in Business with Microsoft Excel 2010 27 Level 1 home

Including Comments in a Worksheet

Succeeding in Business with Microsoft Excel 2010 28 Level 1 home

Level 1 Summary

• Planning an Excel application that others can use

• Validating data entry

• Protecting a workbook

• Providing thorough documentation for users

– Documentation worksheet

– Cell comments

Succeeding in Business with Microsoft Excel 2010 29

Level 2 Objectives: Preventing Errors in Formulas

• Audit formulas for accuracy and validity

• Evaluate and trace formula errors

• Identify, analyze, and correct errors

• Set error-checking options

Succeeding in Business with Microsoft Excel 2010 30

Auditing Formulas

• Taking advantage of more sophisticated Excel tools that help find and respond to formula errors

– Address error messages caused by problems with the formulas in the workbook

– Audit formulas

Succeeding in Business with Microsoft Excel 2010 31 Level 2 home

Addressing Error Messages Caused by Problems with Formulas

• Fix obvious errors

• Use the Error Alert button

• Examine the formula

Succeeding in Business with Microsoft Excel 2010 32 Level 2 home

Using the Formula Auditing Tools

• Permit review of structure and behavior of formula

• Formula auditing group on Ribbon

• May display tracer arrows

– Precedent cells (contain a value used in a formula)

– Dependent cells (contain a formula that refers to other cells)

• Can result in false positives and false negatives

Succeeding in Business with Microsoft Excel 2010 33 Level 2 home

Formula Auditing Tools

Succeeding in Business with Microsoft Excel 2010 34 Level 2 home

Tracing and Solving Formula Errors

Succeeding in Business with Microsoft Excel 2010 35 Level 2 home

Tracing Errors

Succeeding in Business with Microsoft Excel 2010 36 Level 2 home

Identifying and Correcting Errors

Succeeding in Business with Microsoft Excel 2010 37 Level 2 home

Identifying and Correcting Errors

Succeeding in Business with Microsoft Excel 2010 38 Level 2 home

Tracing Precedent Cells

Succeeding in Business with Microsoft Excel 2010 39 Level 2 home

Tracing Precedent Cells

Succeeding in Business with Microsoft Excel 2010 40 Level 2 home

Tracing Dependent Cells

Succeeding in Business with Microsoft Excel 2010 41

Traces components of a formula that references other cells

Level 2 home

Tracing Dependent Cells

Succeeding in Business with Microsoft Excel 2010 42 Level 2 home

Setting Error-Checking Options

Succeeding in Business with Microsoft Excel 2010 43 Level 2 home

Level 2 Summary

• Using Excel formula auditing tools to trace and correct errors

– Auditing formulas

– Evaluating error messages in cells

Succeeding in Business with Microsoft Excel 2010 44

Level 3 Objectives: Automating Excel Tasks

• Plan and record macros

• Run and test macros

• Add macro buttons to a worksheet

• Edit macros using the Visual Basic Editor

Succeeding in Business with Microsoft Excel 2010 45

Understanding Macros

• Series of commands that you store and then run when you need to perform a task

• Steps – stored as Visual Basic for Applications (VBA) commands in the macro – are performed in sequence when you run the macro

• To create a macro

– Use macro recorder, or

– Write from scratch by entering VBA commands in the Visual Basic Editor

Succeeding in Business with Microsoft Excel 2010 46 Level 3 home

Recording a Macro

• Use macro recorder to record keystrokes and mouse actions

• Assign a macro to a shortcut key

Succeeding in Business with Microsoft Excel 2010 47 Level 3 home

Recording a Macro

Succeeding in Business with Microsoft Excel 2010 48 Level 3 home

Running a Macro

• Press the shortcut key assigned to the macro, or

• Use the Macro dialog box

Succeeding in Business with Microsoft Excel 2010 49 Level 3 home

Running a Macro

Succeeding in Business with Microsoft Excel 2010 50 Level 3 home

Creating a Macro Button

Succeeding in Business with Microsoft Excel 2010 51 Level 3 home

Creating a Macro Button

Succeeding in Business with Microsoft Excel 2010 52 Level 3 home

Editing a Macro in the Visual Basic Editor

Succeeding in Business with Microsoft Excel 2010 53

Open Visual Basic

Editor to view the

code of a macro

Level 3 home

Understanding VBA Basics

• Sub procedures

• Comments

• VBA commands the macro performs

• “End Sub” indicates end of sub procedure or macro

Succeeding in Business with Microsoft Excel 2010 54 Level 3 home

Sample Workbook

Succeeding in Business with Microsoft Excel 2010 55 Level 3 home

Level 3 Summary

• Automating a workbook by creating and running a macro

• Assigning a button to the macro to make it easy to use

• Working in the Visual Basic Editor window to edit a macro so it runs more efficiently

Succeeding in Business with Microsoft Excel 2010 56

Chapter Summary

• Creating an Excel application that functions as a decision support system

– Preparing error-free workbooks

– Preventing errors in formulas

– Automating Excel tasks

Succeeding in Business with Microsoft Excel 2010 57