Excel Tutorial 8

Report
Excel Tutorial 8
Developing an Excel
Application
COMPREHENSIVE
Objectives
XP
• 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
• Create validation rules for data entry
• Protect the contents of worksheets and
workbooks
New Perspectives on Microsoft Office Excel 2007
2
Objectives
XP
• Add, edit, and delete comments
• Learn about macro viruses and Excel security
features
• Create a macro using the macro recorder
• Edit a macro using the Visual Basic Editor
• Assign a macro to a keyboard shortcut and a
button
• Save a workbook in macro enabled format
• Minimize the Ribbon
New Perspectives on Microsoft Office Excel 2007
3
Planning an Excel Application
XP
• An Excel application is a spreadsheet written or
tailored to meet the user’s specific needs
New Perspectives on Microsoft Office Excel 2007
4
Naming Cells and Ranges
XP
• A defined name (often called simply a name) is a word or string of characters
associated with a single cell or a range
• Select the cell or range to which you want to assign a name
• Click in the Name box on the formula bar, type the name, and then press the
Enter key (or in the Defined Names group on the Formulas tab, click the Define
Name button, type a name in the Name box, and then click the OK button)
Or
• Select the range with labels and blank cells in the top row or first column to
which you want to assign a name
• In the Defined Names group on the Formulas tab, click the Create From
Selection button
• Specify whether to create the ranges based on the top row, bottom row, left
column, or right column in the list
• Click the OK button
New Perspectives on Microsoft Office Excel 2007
5
Naming Cells and Ranges
New Perspectives on Microsoft Office Excel 2007
XP
6
Adding Defined Names to Existing
Formulas
XP
• In the Defined Names group on the Formulas tab, click
the Define Name button arrow, and then click Apply
Names (if the cell reference and defined name
definition are in the same worksheet)
• In the Apply Names dialog box, select the names you
want to apply, and then click the OK button
Or
• Edit the formula by selecting the cell reference and
typing the defined name (or clicking the appropriate
cell)
New Perspectives on Microsoft Office Excel 2007
7
Adding Defined Names to Existing
Formulas
New Perspectives on Microsoft Office Excel 2007
XP
8
Validating Data Entry
XP
• To ensure that correct data is entered and stored
in a worksheet, you can use data validation to
create a set of rules that determine what users
can enter in a specific cell or range
• An input message appears when the cell
becomes active and can be used to specify the
type of data the user should enter in that cell
• An error alert message appears if a user tries to
enter a value in the cell that does not meet the
validation rule
New Perspectives on Microsoft Office Excel 2007
9
Validating Data Entry
XP
• In the Data Tools group on the Data tab, click the Data Validation
button
• Click the Settings tab
• Click the Allow arrow, click the type of data allowed in the cell, and
then enter the validation criteria for that data
• Click the Input Message tab, and then enter a title and text for the
input message
• Click the Error Alert tab, and then, if necessary, click the Show error
alert after invalid data is entered check box to insert a check mark
• Select an alert style, and then enter the title and text for the error alert
message
• Click the OK button
New Perspectives on Microsoft Office Excel 2007
10
Validating Data Entry
New Perspectives on Microsoft Office Excel 2007
XP
11
Protecting a Worksheet
XP
• Select the cell or range you want to unlock.
• In the Font group on the Home tab, click the Dialog Box
Launcher
• In the Format Cells dialog box, click the Protection tab, click
the Locked check box to remove the check mark, and then click
the OK button
• In the Changes group on the Review tab, click the Protect
Sheet button
• Enter a password (optional)
• Select all of the actions you want to allow users to take when
the worksheet is protected
• Click the OK button
New Perspectives on Microsoft Office Excel 2007
12
Protecting a Workbook
XP
• In the Changes group on the Review tab, click the
Protect Workbook button
• Click the check boxes to indicate whether you
want to protect the workbook’s structure,
windows, or both
• Enter a password (optional)
• Click the OK button
New Perspectives on Microsoft Office Excel 2007
13
Adding Worksheet Comments
XP
• A comment is a text box that is attached to a
specific cell in a worksheet
• Click the cell to which you want to attach a
comment
• Right-click the cell, and then click Insert
Comment on the shortcut menu (or in the
Comments group on the Review tab, click the
New Comment button)
• Type the comment into the comment box
New Perspectives on Microsoft Office Excel 2007
14
Adding Worksheet Comments
New Perspectives on Microsoft Office Excel 2007
XP
15
Working with Macros
XP
• A macro is a series of stored commands that can
be run whenever you need to perform the task
• The Developer tab will enable you to create and
use macros
• If the Developer tab isn’t available, you will need
to enable it using the Excel Options
New Perspectives on Microsoft Office Excel 2007
16
Protecting Against Macro Viruses
XP
• Macro viruses are a type of virus that uses a
program's own macro programming language to
distribute the virus
• The macro security settings control what Excel
will do about macros in a workbook when you
open that workbook
– Disable all macros without notification
– Disable a macro with notification
– Disable all macros except digitally signed macros
– Enable all macros
New Perspectives on Microsoft Office Excel 2007
17
Setting Macro Security in Excel
XP
• In the Code group on the Developer tab, click the Macro Security
button
• Click the option button for the security setting you want
• Click the OK button
or
• Click the Office Button, and then click the Excel Options button
• Click the Trust Center category, and then click the Trust Center
Settings button
• Click the Macro Settings category, and then select the option
button for the security setting you want
• Click the OK button
New Perspectives on Microsoft Office Excel 2007
18
Recording a Macro
XP
• In the Code group on the Developer tab, click the
Record Macro button
• Enter a name for the macro, and specify the
location to store the macro
• Specify a shortcut key (optional)
• Enter a description of the macro (optional)
• Click the OK button to start the macro recorder
• Perform the tasks you want to automate
• Click the Stop Recording button
New Perspectives on Microsoft Office Excel 2007
19
Running a Macro
XP
• Press the shortcut key assigned to the macro
or
• In the Code group on the Developer tab, click the
Macros button
• Select the macro from the list of macros, and
then click the Run button
New Perspectives on Microsoft Office Excel 2007
20
Editing a Macro
XP
• In the Code group on the Developer tab, click the
Macros button, select the macro in the Macro
name list, and then click the Edit button (or in
the Code group on the Developer tab, click the
Visual Basic button)
• Use the Visual Basic Editor to edit the macro
code
• Click File on the menu bar, and then click Close
and Return to Microsoft Excel
New Perspectives on Microsoft Office Excel 2007
21
Editing a Macro
New Perspectives on Microsoft Office Excel 2007
XP
22
Creating a Macro Button
XP
• In the Controls group on the Developer tab, click
the Insert button
• In the Form Controls section, click the Button
(Form Control) tool, click the worksheet where
you want the macro button to be located, drag
the pointer until the button is the size and shape
you want, and then release the mouse button
• In the Assign Macro dialog box, select the macro
you want to assign to the button, and then, with
the button still selected, type a new label
New Perspectives on Microsoft Office Excel 2007
23
Creating a Macro Button
New Perspectives on Microsoft Office Excel 2007
XP
24
Saving Workbooks with Macros
XP
• On the Quick Access Toolbar, click the Save
button
• Click No in the dialog box
• Save as an Excel Macro-Enabled Workbook
New Perspectives on Microsoft Office Excel 2007
25
Opening a Workbook with Macros
New Perspectives on Microsoft Office Excel 2007
XP
26

similar documents