IS-171 Computing With Spreadsheets List Management and Macros Week 7

advertisement
IS-171
Computing With Spreadsheets
List Management and Macros
Week 7
Outline

List and Data Management

Database Issues

Macros
5/29/2016
Carol Wilson and Fred Ferwerda
2
Recall the Data Hierarchy

Bit
(binary 0 or 1)

Byte
(8 bits = a character or number)

Field
(e.g., Name = a column in a table)

Record
(multiple fields = a row in a table)

File
(multiple records/rows  Excel)

Database
(relational DB = multiple tables)
5/29/2016
Carol Wilson and Fred Ferwerda
3
Manipulating Excel Lists

Importing text files

Sorting

Filtering
(similar to database query)

Subtotals
(similar to database report)

Pivot Table
(similar to database report)
5/29/2016
Carol Wilson and Fred Ferwerda
4
Feature Creep


Now we have facilities for importing
sorting, filtering, and reporting, as well
as a means to pass data between
multiple worksheets.
We get something approaching a
database management system
(DBMS), without having one.
5/29/2016
Carol Wilson and Fred Ferwerda
5
Excel vs Database

When to use databases
•
•
•
•
•

(instead of Excel):
Large data sets
Formed input and output
Arbitrary and complicated queries
Multiple users
Security
IS-141 covers databases
5/29/2016
Carol Wilson and Fred Ferwerda
6
What is a Macro?
•
•
•
A set of instructions telling Excel what
commands to execute
Written in Visual Basic for Applications
(VBA)
Recorded with the Macro Recorder
5/29/2016
Carol Wilson and Fred Ferwerda
7
Recording a Macro
•
NameAndCourse macro
•
Shortcut key
•
Record macro
•
Stop recording
5/29/2016
Carol Wilson and Fred Ferwerda
8
Elements of a Macro
•
Sub/End Sub
•
Comments
•
Variables
•
Properties
•
With Statement
5/29/2016
Carol Wilson and Fred Ferwerda
9
Step Into
•
Executes one command of the macro
•
Other debugging commands available
5/29/2016
Carol Wilson and Fred Ferwerda
10
Personal Macro Workbook
•
Opened every time Excel starts
•
Only on your machine
•
Always accessible
5/29/2016
Carol Wilson and Fred Ferwerda
11
User Interaction Functions
•
InputBox
•
MsgBox
5/29/2016
Carol Wilson and Fred Ferwerda
12
Download