Microsoft Office Illustrated

Slides:



Advertisements
Similar presentations
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.
Advertisements

Using Macros and Visual Basic for Applications (VBA) with Excel
Developing an Excel Application
Tutorial 8: Developing an Excel Application
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
VBA for MS Excel Hamze Msheik. Open the Visual Basic Editor in Excel 2007 Click on the Microsoft Office button in the top left of the Excel window and.
With Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2010.
Excel and VBA Creating an Excel Application
Microsoft Excel 2003 Illustrated Complete with Excel Programming.
Exploring Office Grauer and Barber 1 Creating More Powerful Applications: Introduction to VBA(Wk9)
Customizing Word Microsoft Office Word 2007 Illustrated Complete.
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.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Adding Automated Functionality to Office Applications.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
Excel Lesson 14 Creating and Using Macros Microsoft Office 2010 Advanced Cable / Morrison 1.
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.
Word Lesson 16 Working with Macros Microsoft Office 2010 Advanced Cable / Morrison 1.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
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.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 22 Macros.
Copyright 2007, Paradigm Publishing Inc. EXCEL 2007 Chapter 7 BACKNEXTEND 7-1 LINKS TO OBJECTIVES Record & run a macro Record & run a macro Save as a macro-
Creating Macros Using VBA. Assigning a Macro to a Button Display the Forms toolbar. Click the Button icon. Click and drag the mouse pointer to specify.
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.
® Microsoft Access 2010 Tutorial 11 Using and Writing Visual Basic for Applications Code.
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Visual Basic for Applications Macro Programming For Microsoft Office.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
OCC Network Drives  H:\  P:\ 
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 9 Macros And Visual Basic For Applications.
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.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft® Excel 2013.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
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
Outline In this module, the following topics will be covered:
Chapter 1: An Introduction to Visual Basic 2015
Developing an Excel Application
Microsoft Access 2003 Illustrated Complete
Microsoft Access Illustrated
Microsoft Excel 2003 Illustrated Complete
Introducing VBA Macros
Introduction to VBA for Excel and its utilization in numerical methods
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Exploring Microsoft® Excel® 2016 Series Editor Mary Anne Poatsy
Exploring Microsoft Excel
CIS16 Application Development Programming with Visual Basic
Microsoft Office Excel 2003
Tutorial 11 Using and Writing Visual Basic for Applications Code
Microsoft Excel 2007 – Level 2
Presentation transcript:

Microsoft Office 2013 - Illustrated Unit P: Programming with Excel

Objectives View VBA code Analyze VBA code Write VBA code Add a conditional statement Microsoft Office Excel 2013 - Illustrated

Objectives (cont’d.) Prompt the user for data Debug a macro Create a main procedure Run a main procedure Microsoft Office Excel 2013 - Illustrated

View VBA Code VBA (Visual Basic for Applications): programming language for macros Visual Basic Editor: tool within Excel Enter and edit VBA code Procedure: sequence of VBA statements Microsoft Office Excel 2013 - Illustrated

View VBA Code (cont’d.) Procedure header: defines the procedure’s type, name, and arguments Arguments: variables used by other procedures that the main procedure might run Microsoft Office Excel 2013 - Illustrated

View VBA Code (cont’d.) Comments: notes explaining code; displayed in green Keywords: recognized parts of VBA programming language; displayed in blue Sub procedure: series of VBA statements; perform an action but do not return a value Microsoft Office Excel 2013 - Illustrated

View VBA Code (cont’d.) Microsoft Office Excel 2013 - Illustrated

View VBA Code (cont’d.) Understanding the Visual Basic Editor Module: equivalent of a worksheet Stores macro procedures Stored in a workbook/project with worksheets Project: collection of all workbook procedures Microsoft Office Excel 2013 - Illustrated

View VBA Code (cont’d.) Understanding the Visual Basic Editor (cont’d.) Project Explorer: displays a list of all open projects (or workbooks) and the worksheets and modules they contain Code window: displays the selected module’s procedures Properties window: displays a list of characteristics related to the module Microsoft Office Excel 2013 - Illustrated

Analyze VBA Code Object: every element Range object: cell or a range of cells Statement: line of code Property: attribute defining an object’s characteristic Procedure footer: last line of VBA code indicating end of procedure Microsoft Office Excel 2013 - Illustrated

Analyze VBA Code (cont’d.) Microsoft Office Excel 2013 - Illustrated

Write VBA Code Open the Visual Basic Editor, add a module to the workbook, and write the code Syntax: programming language’s formatting rules applied to code writing Microsoft Office Excel 2013 - Illustrated

Write VBA Code (cont’d.) Microsoft Office Excel 2013 - Illustrated

Write VBA Code (cont’d.) Entering code using AutoComplete VBA Editor provides AutoComplete List of words: can be used in the macro statement and matches what you type Appears after you press [.] (period) Select a word in the list: double-click it or press [Tab] Microsoft Office Excel 2013 - Illustrated

Add a Conditional Statement If...Then…Else statement: code entered in a procedure to perform an action based on a certain condition or set of conditions Microsoft Office Excel 2013 - Illustrated

Add a Conditional Statement (cont’d.) Microsoft Office Excel 2013 - Illustrated

Prompt the User for Data Function: predefined procedure that returns a value InputBox function’s required elements: object.InputBox(“prompt”) Prompt: user-friendly message that appears in input box Variable: memory location for temporarily information storage Microsoft Office Excel 2013 - Illustrated

Prompt the User for Data (cont’d.) Microsoft Office Excel 2013 - Illustrated

Prompt the User for Data (cont’d.) Naming variables (in VBA) Must begin with a letter Uppercase or lowercase letters allowed Up to 255 characters long Each name must be unique Microsoft Office Excel 2013 - Illustrated

Debug a Macro Bug: error in code Debug: locate and correct error Step Into: opens Visual Basic Editor with yellow statement selector positioned on the procedure’s first statement Press [F8] to step to successive statements Microsoft Office Excel 2013 - Illustrated

Debug a Macro (cont’d.) Statement selector positioned on first procedure statement Microsoft Office Excel 2013 - Illustrated

Debug a Macro (cont’d.) Adding security to your macro projects Add a digital signature: guarantees the project hasn’t been altered since it was signed Sign macros only after testing and ready to distribute Microsoft Office Excel 2013 - Illustrated

Create a Main Procedure Main procedure: several macros combined into a single procedure Runs multiple procedures in sequence Call statement syntax: Call procedurename Place call statements in sequence in the main procedure Microsoft Office Excel 2013 - Illustrated

Create a Main Procedure (cont’d.) Microsoft Office Excel 2013 - Illustrated

Create a Main Procedure (cont’d.) Copying a macro to another workbook Open both the source and destination Excel workbooks Open the Visual Basic Editor and verify that macros are enabled In Project Explorer, drag the module that will be copied from the source workbook to the destination workbook Microsoft Office Excel 2013 - Illustrated

Create a Main Procedure (cont’d.) Writing and documenting VBA code Make code readable by indenting and adding comments Comments: begin with an apostrophe Microsoft Office Excel 2013 - Illustrated

Run a Main Procedure Click the name of the main procedure in the Macro dialog box and click Run Main procedure: runs several macros in sequence Microsoft Office Excel 2013 - Illustrated

Run a Main Procedure (cont’d.) Running a macro using a button Assign a macro to a button on a worksheet Create a button, right-click on the button, click Assign macro, and click the desired macro Label the button with descriptive text Microsoft Office Excel 2013 - Illustrated