Microsoft Excel 2003 Illustrated Complete with Excel Programming.

Slides:



Advertisements
Similar presentations
Access Lesson 13 Programming in Access Microsoft Office 2010 Advanced Cable / Morrison 1.
Advertisements

© Paradigm Publishing, Inc Excel 2013 Level 2 Unit 2Managing and Integrating Data and the Excel Environment Chapter 7Automating Repetitive Tasks.
Visual Basic for Applications. What it does Extends the features and built in functions of Excel – Create and run VB procedures – Some may be easy to.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Excel Project 7 Using Macros and Visual Basic for Applications (VBA) with Excel.
Using Macros and Visual Basic for Applications (VBA) with Excel
Developing an Excel Application
Tutorial 8: Developing an Excel Application
© 2002 ComputerPREP, Inc. All rights reserved. Excel 2000: Customizing Excel and Using Macros.
XP New Perspectives on Microsoft Excel 2003, Second Edition- Tutorial 8 1 Microsoft Office Excel 2003 Tutorial 8 – Developing an Excel Application.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
With Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2010.
Exploring Microsoft Access Chapter 8 Creating More Powerful Applications: Introduction to VBA By Robert T. Grauer Maryann Barber.
Exploring Office Grauer and Barber 1 Creating More Powerful Applications: Introduction to VBA(Wk9)
Customizing Word Microsoft Office Word 2007 Illustrated Complete.
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
SUNY Morrisville-Norwich Campus-Week 12 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
Using the Visual Basic Editor Visual Basic for Applications 1.
Adding Automated Functionality to Office Applications.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
Macros n Macros are little programs that you can create to automate particular tasks that you may want to execute more easily than having to specify all.
Object Variables Visual Basic for Applications 3.
Project 9 Using Visual Basic for Applications (VBA) to Customize and Automate Excel Jason C. H. Chen, Ph.D. Professor of Management Information Systems.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
Microsoft Excel 2007 © Wiley Publishing All Rights Reserved. The L Line The Express Line to Learning L Line.
© McGraw-Hill Companies, Inc., McGraw-Hill/Irwin Extended Learning Module M Programming in Excel with VBA.
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. Extended Learning Module M Programming in Excel with VBA.
Automating Tasks with Visual Basic. Introduction  When can’t find a readymade macro action that does the job you want, you can use Visual Basic code.
Microsoft Excel Macros & Excel Solver (IENG490)
Introduction to VBA MGMI Aug What is VBA? VBA = Visual Basic for Application Excel’s powerful built-in programming language An event-driven.
Chapter 11: Introduction to the Visual Basic Environment Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Visual Basic for Applications Macro Programming For Microsoft Office.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
OCC Network Drives  H:\  P:\ 
The Object Model Visual Basic for Applications 2.
Date Variables Visual Basic for Applications 5. Objectives n In this tutorial, you will learn how to: n Reserve a Date variable n Use an assignment statement.
Chapter 3 The Visual Basic Editor. Important Features of the VBE Alt-F11 will open the Visual Basic Editor. The Code window is to the right, Project Explorer.
Exploring Microsoft Access Chapter 8 Creating More Powerful Applications: Introduction to VBA.
Chapter 9 Macros And Visual Basic For Applications.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
Chapter 11: Introduction to VBA Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Introduction to Excel VBA UNC Charlotte CPE/PDH Series December 17, 2009.
Microsoft Excel Illustrated Programming with Excel.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft® Excel 2013.
Introduction to Microsoft Excel Macros COE 201- Computer Proficiency.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft® Excel 2013.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Using Macros Lesson.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
The Advantage Series ©2005 The McGraw-Hill Companies, Inc. All rights reserved Chapter 12 Introducing Visual Basic for Applications Microsoft Office Excel.
Excel Tutorial 8 Developing an Excel Application
Exploring Excel Chapter 7 Automating Repetitive Tasks: Macros and
Chapter 1: An Introduction to Visual Basic 2015
Microsoft Access 2003 Illustrated Complete
Microsoft Access Illustrated
Microsoft Office Illustrated
Microsoft Excel 2003 Illustrated Complete
Introducing VBA Macros
Introduction to VBA for Excel and its utilization in numerical methods
Exploring Microsoft Excel
CIS16 Application Development Programming with Visual Basic
Microsoft Office Excel 2003
Presentation transcript:

Microsoft Excel 2003 Illustrated Complete with Excel Programming

2Programming with ExcelUnit P  View VBA code  Analyze VBA code  Write VBA code  Add a conditional statement Objectives

3Programming with ExcelUnit P  Prompt the user for data  Debug a macro  Create a main procedure  Run a main procedure Objectives

4Programming with ExcelUnit P Unit Introduction  Excel macros are written in a programming language called Visual Basic for Applications, or VBA –Create a macro with the Excel macro recorder –The recorder writes the VBA instructions for you Enter VBA instructions manuallyEnter VBA instructions manually –Sequence of VBA statements is called a procedure

5Programming with ExcelUnit P Viewing VBA Code  View existing VBA code to learn the language –To view VBA code, open the Visual Basic Editor Contains a Project Explorer window, a Properties window, and a Code windowContains a Project Explorer window, a Properties window, and a Code window –VBA code appears in the Code window The first line of a procedure is called the procedure headerThe first line of a procedure is called the procedure header Items displayed in blue are keywordsItems displayed in blue are keywords Green notes explaining the code are called commentsGreen notes explaining the code are called comments

6Programming with ExcelUnit P Viewing VBA Code (cont.) Comments Procedure header Keyword

7Programming with ExcelUnit P Viewing VBA Code (cont.)  Understanding the Visual Basic Editor –A module is the Visual Basic equivalent of a worksheet Store macro proceduresStore macro procedures A module is stored in a workbook, or project, along with worksheetsA module is stored in a workbook, or project, along with worksheets View and edit modules in the Visual Basic EditorView and edit modules in the Visual Basic Editor

8Programming with ExcelUnit P Analyzing VBA Code  Analyzing VBA code –Every element of Excel, including a range, is considered an object –A range object represents a cell or a range of cells –A property is an attribute of an object that defines one of the object’s characteristics, such as size –The last line in VBA code is the procedure footer

9Programming with ExcelUnit P Analyzing VBA Code (cont.) Selects range object cell A2 Applies bold formatting to range A3:F3 Sets width of columns B-F to AutoFit

10Programming with ExcelUnit P Writing VBA Code  To write your own code, open the Visual Basic Editor and add a module to the workbook –You must follow the formatting rules, or syntax, of the VBA programming language exactly –A misspelled keyword of variable name will cause a procedure to fail

11Programming with ExcelUnit P Writing VBA Code (cont.) Comments begin with apostrophes Information between quotes will be inserted in the active cell

12Programming with ExcelUnit P Writing VBA Code (cont.)  Entering code using the scrollable word list –To assist you in entering the VBA code, the Editor often displays a list of words that can be used in the macro statement –Typically the list appears after you press period [.]

13Programming with ExcelUnit P Adding a Conditional Statement  Sometimes you may want a procedure to take an action based on a certain condition or set of conditions –One way to add this type of statement is by using an If...Then…Else statement –The syntax for this statement is: If condition then statements Else [else statements]

14Programming with ExcelUnit P Adding a Conditional Statement (cont.) Elements of the If…then…Else statement appear in blue

15Programming with ExcelUnit P Prompting the User for Data  When automating routine tasks, sometimes you need to pause a macro for user input –Use the VBA InputBox function to display a dialog box that prompts the user for information –A function is a predefined procedure that returns a value

16Programming with ExcelUnit P Prompting the User for Data (cont.) This text will appear in a dialog box Comment points out error in next line of the procedure

17Programming with ExcelUnit P Debugging a Macro  When a macro procedure does not run properly, it can be due to an error, called a bug, in the code –To help you find bugs in a procedure, the Visual Basic Editor steps through the procedure’s code one line at a time –When you locate an error, you can debug, or correct it

18Programming with ExcelUnit P Debugging a Macro (cont.) Indicates that the LeftFooter variable is empty

19Programming with ExcelUnit P Creating a Main Procedure  Combine several macros that you routinely run together into a procedure –This is a main procedure –To create a main procedure, type a Call statement for each procedure you want to run

20Programming with ExcelUnit P Creating a Main Procedure (cont.) MainProcedure calls each procedure in the order shown

21Programming with ExcelUnit P Running a Main Procedure  Running a main procedure allows you to run several macros in sequence –Run a main procedure as you would any other macro –Click Run in the Macro dialog box

22Programming with ExcelUnit P Running a Main Procedure (cont.) Current Module button Printing Macro Procedures Current Project button

23Programming with ExcelUnit P Summary  Learn by viewing and analyzing VBA code  Write VBA code using the Visual Basic Editor  Use If..Then..Else statements for conditional actions  Prompt user for data to automate input tasks  Use the “Step Into” feature of the Visual Basic Editor to debug macros  Use Main procedures to combine several macros