lecture excel: multiple worksheets. workbook and worksheets multiple worksheets in a single...

32
Lecture Excel: Multiple Worksheets

Post on 21-Dec-2015

230 views

Category:

Documents


0 download

TRANSCRIPT

Lecture

Excel: Multiple Worksheets

Workbook and Worksheets

• Multiple worksheets in a single workbook.

• When saved, only a single workbook (XLS) is saved which will contain all of the worksheets.

Purpose

• Used to track different groups of information in a single Workbook

• Examples:– Expenses, Income, and Summary– Data from 12 Months– Each Employee’s Sales– Each Product’s Performance

Advantages:

• Allows setting the print options for a number of sheets at once.

• Allows applying formats to many sheets.

• Allows unhiding of rows and/or columns simultaneously.

• Allows typing/inserting text or formulas for the same cell address in all grouped sheets.

Selecting Worksheets

Worksheet tabs

• Initially: 3 worksheets

• Max: 255 worksheets• Change default in

Options

First Sheet Prior Sheet

Next Sheet

Last Sheet

Worksheet Options

• Insert (to add a new worksheet)• Delete• Rename (to identify it)• Move (to another workbook)• Copy (to another workbook, or clone)• Rearrange (change the order)• Color (make sheets easy to find)

Right-Click on Tab

Grouped Worksheet Actions

• When multiple worksheets are selected (grouped), changes are made to all worksheets simultaneously

• Use this to:– Make formatting changes– Add rows/columns– Change page setup (orientation, header)– Change text/data

To Group Worksheets

1. Click first sheet tab2. Hold down Shift3. Click last sheet tab

1. Click first sheet tab2. Hold down Control3. Click each sheet tab

or

Select contiguousWorksheets

Select individualWorksheets

Caution!!

• It is easy to forget that multiple worksheets are selected

• Deleting or changing values will affect all worksheets selected

Ungrouping Worksheets

• Right-Click tab, choose Ungroup Sheets

• Left-click any tabNOT part of the group

Formula References in Sheets

• Syntax: =Income!B2

• Helpful to use point and click• Examples:

=A2 + Sales!B7=Income!B10 – Expenses!B10=Sum(Employees!C2:Employees!C99)=Sum(Week1:Week4!D2)

Sheet Name Cell

Additional Financial Analysis

• Cost of Sales: • What percentage of your income is

devoted to expenses? • How much does it cost you to just

keep your doors open? • Divide Expenses by Income

Additional Financial Analysis

• Profit Margin: What is your profit margin?

• 20% to 35% is considered a good profit margin

• Divide Profits by Income to come up with the profit Margin

Conditional Formatting

• Conditional formatting formats cells based on their content, or the content of other cells.

• IF the profit margin is greater than 30% fill this cell with yellow formatting and make it bold.

Conditional FormattingExcel 2003 and 2007

Conditional Formatting

• Requires that you set up a rule for the formatting

• Create a new rule• Setup the parameters• Define the formatting options

Conditional Formatting

Lecture

Excel: Macros

Macros

• A macro is a series of commands that are stored and can be run whenever you need to perform the task

Macros, cont.

• Set of instructions that can be automated within Excel

• Purpose is to eliminate repetitive tasks as well as simplify

• Examples include adding or deleting rows or columns; adding a specific header; adding the date to a sheet

Security

• Viruses can be attached to macros • Security settings have to be set to

enable macros to run • Ensure you know it’s your file or

from a trusted source before enabling

Create a New Macro

• Macros are created from the View or Developer tab

• Actions can be recorded and then RUN in other sheets and workbooks

Two Ways

• There are two ways to create a macro• The recordable option offers an easier

interface for users to create Macros without needing to know the underlying VBA (Visual Basic for Applications) code

• The second option allows users to code directly utilizing VBA

Editing

• Even when macros have been recorded, users can edit the underlying VBA code to adjust colors, change ranges, update a function, etc.

Editing Macros – Visual Basic Editor

Sub Sum() Sum Macro' Range("N5").Select ActiveCell.FormulaR1C1 = "=SUM(RC[-12]:RC[-1])" Range("N5").Select Selection.AutoFill Destination:=Range("N5:N7"),

Type:=xlFillDefault Range("N5:N7").Select Range("B8").Select ActiveCell.FormulaR1C1 = "=SUM(R[-3]C:R[-1]C)" Range("B8").Select

Record and Edit

Save Macros

• Macros saved to workbook are only available within that workbook

• Macros saved to Personal Workbook are available within the software program itself

• The Personal Workbook is hidden and to make edits to macros stored there, it must first be unhidden from the toolbar

Save Macros, cont.

• A file with Macros will not save with the normal .xls or .xlsx extension

• It will prompt you to save with the .xlsm extension (Excel – Macro Enabled Workbook)

Run a Macro

• Macros can be run manually from the menu

• They can also be set to run automatically after another action, such as opening a workbook

• Macros can be set to run after clicking on a button

Macros In Action – Ex. #1

• Add another year and delete all the totals!

• View tab – Record Macros in Workbook• Go through the process of adding

formulas to the 2011 sheet…formatting to.

• All done – stop recording.

Macros in action – Ex. #1

• Copy the 2010 data to a new sheet, creating a sheet for 2012.

• Delete all of the totals. • Run Macro!

Example…Assign to a Button