1 VBA Introduction. Basic Components 2 VBA LANGUAGE OFFICE OBJECTS EXCEL OBJECTS ACCESS OBJECTS WORD OBJECTS OUTLOOK OBJECTS POWERPOINT OBJECTS.

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

Sep-05 Slide:1 VBA in Excel Walter Milner. Sep-05 Slide:2 VBA in Excel Introduction VBA = Visual Basic for Applications Enables end-user programming In.
Slide 1 Insert your own content. Slide 2 Insert your own content.
Chapter 6, Slide 1Starting Out with Visual Basic 3 rd Edition Chapter 6 Sub Procedures And Functions.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Excel Object Model.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
List and Search Grants Chapter 2. List and Search Grants 2-2 Objectives Understand the option My Grants List Grant Screen Viewing a Grant Understand the.
0 - 0.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
MULTIPLICATION EQUATIONS 1. SOLVE FOR X 3. WHAT EVER YOU DO TO ONE SIDE YOU HAVE TO DO TO THE OTHER 2. DIVIDE BY THE NUMBER IN FRONT OF THE VARIABLE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
FACTORING Think Distributive property backwards Work down, Show all steps ax + ay = a(x + y)
Addition Facts
Integrated Business Applications with Databases (D3) Jenny Pedler
Empty Box Problems Subtraction = 3 If you start on 6 and jump back 3 spaces you land on
Managing data using CSPro
Introduction to Visual Basic for Applications programming in Excel.
Excel Functions. Part 1. Introduction 2 An Excel function is a formula or a procedure that is performed in the Visual Basic environment, outside the.
1 After completing this lesson, you will be able to: Compose, address, and send messages. Format the body of a message. Attach a file to a message. Check.
Excel Lesson 9 Applying Advanced Formats to Worksheets
Access Lesson 13 Programming in Access Microsoft Office 2010 Advanced Cable / Morrison 1.
Integration Integrating Word, Excel, Access, and PowerPoint
INTRODUCTORY MICROSOFT ACCESS Lesson 1 – Access Basics
O X Click on Number next to person for a question.
© S Haughton more than 3?
1 Directed Depth First Search Adjacency Lists A: F G B: A H C: A D D: C F E: C D G F: E: G: : H: B: I: H: F A B C G D E H I.
Take from Ten First Subtraction Strategy -9 Click on a number below to go directly to that type of subtraction problems
Energy & Green Urbanism Markku Lappalainen Aalto University.
CSM18 Visual Basic Section1 Department of Computing UniS 1 CSM18 Interactive Computing Introduce Visual Basic language - provides excellent facilities.
Past Tense Probe. Past Tense Probe Past Tense Probe – Practice 1.
1 Overview Introduction to VBA The Visual Basic Editor (VBE) –First Program Getting Started with VBA –Subroutines –Declaring variables –Input boxes and.
Addition 1’s to 20.
25 seconds left…...
Test B, 100 Subtraction Facts
11 = This is the fact family. You say: 8+3=11 and 3+8=11
Week 1.
We will resume in: 25 Minutes.
1 Ke – Kitchen Elements Newport Ave. – Lot 13 Bethesda, MD.
O X Click on Number next to person for a question.
PSSA Preparation.
Number Bonds to = = = = = = = = = = = 20.
New Rubrics? Create Assignment and Project Templates and Send the Assignments in Tk20 Must do before you can use updated rubrics Theresa Dorn.
Benchmark Series Microsoft Excel 2013 Level 2
ISOM3230 Business Applications Programming
Excel and Visual Basic. Outline Data exchange between Excel and Visual Basic. Programming VB in Excel.
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.
AE6382 VBA - Excel l VBA is Visual Basic for Applications l The goal is to demonstrate how VBA can be used to leverage the power of Excel u VBA syntax.
CVEV 118/698 Visual Basic Lecture 1 Prof. Mounir Mabsout Expert 1: Elsa Sulukdjian Expert 2: Walid El Asmar.
VBA Programming Session #2. Things to Review  Variables  Procedures: Subs & Functions  If…Then  For…Next.
VBA & Excel Barry L. Nelson IEMS 465 Fall Quarter 2003.
Chapter 11: Introduction to the Visual Basic Environment Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
ME 142 Engineering Computation I Using Subroutines Effectively.
Chapter 11: Introduction to VBA Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Controls and Events. The Next Step In the first module, we discussed general problem solving In this module, we’ll apply what we learned, from specification.
Introduction to Excel VBA UNC Charlotte CPE/PDH Series December 17, 2009.
Arrays and others. Annoucement Today’s office hour move to Friday 1:00PM to 3:00PM Today’s office hour move to Friday 1:00PM to 3:00PM Today Today  Call.
ME 142 Engineering Computation I Using Subroutines Effectively.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
VBA Excel Macro 1.Create a Macro: To create a macro in Excel VBA, Create a Macro: To create a macro in Excel VBA,Create a Macro: To create a macro.
VBA - Excel VBA is Visual Basic for Applications
VBA - Excel VBA is Visual Basic for Applications
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Presentation transcript:

1 VBA Introduction

Basic Components 2 VBA LANGUAGE OFFICE OBJECTS EXCEL OBJECTS ACCESS OBJECTS WORD OBJECTS OUTLOOK OBJECTS POWERPOINT OBJECTS

3 Getting To VBA

4 Excel VBA Windows Project ExplorerPropertiesCode workbook worksheet module(s)

5 Using Variables

6 Insert Module Module Code Procedure

7 Simple Procedure Sub UsingVariables() v_num = 34 v_str = "Hello" v_str = "Hello" v_dat = Date$ v_dat = Date$ v_num & " " & v_str & " " & v_dat End Sub Immediate Window debug.print

8 Simple Procedure option explicit Sub UsingVariables() Dim v_num As Single, v_str As String, v_dat As Date v_num = 34 v_num = 34 v_str = "Hello" v_str = "Hello" v_dat = Date$ v_dat = Date$ End Sub

9 Simple Calculation Procedure Sub Revenue Dim Units As Integer, Price As Single, Revenue as Single Units = 3 Price = 2.45 Revenue = Units * Price Debug.Print Revenue End Sub

10 Procedure With Parameters Sub Revenue(p_units as integer, p_price as single) Dim Revenue as Single Revenue = p_units * p_price Debug.Print Revenue End Sub

11 …. Calling A Procedure With Parameters Sub Revenue(p_units as integer, p_price as single) Dim Revenue as Single Revenue = p_units * p_price Debug.Print Revenue End Sub Sub Calculate_Revenue Dim Units As Integer, Price As Single Units = 3 Price = 2.45 Call Revenue(Units, Price) End Sub

12 …. Calling A Function With Parameters Function Revenue(p_units as integer, p_price as single) Revenue = p_units * p_price End Function Sub Calculate_Revenue Dim Units As Integer, Price As Single, Calc_Rev As Single Units = 3 Price = 2.45 Calc_Rev = Revenue (Units, Price) Debug.Print Calc_Rev End Sub

13 Using Your Function In The Spreadsheet 1.Developer Macros 2.Type into Macro Name box 3.Click Options button 4.Add description

14 More Variables Sub UsingVariants() Dim var1 As Variant var1 = 34 var1 = Date var1 = " Hello " var1 = Null var1 = Empty End Sub

15 Simple Array Variables Sub SimpleArray() Dim a() As Integer, b(3) As String a(0) = 2 ReDim a(2) a(0) = 4 b(0) = "Hello" ReDim Preserve a(5) a(4) = 6 b(3) = "Goodbye" Debug.Print a(0) * a(4) & b(0) & " and "; b(3) End Sub

16 Variant Array Sub VariantArray() Dim VA(4) VA(1) = 33 VA(2) = "A string" VA(3) = Date$ End Sub

17 Variant Array With Array Function Option Base 1 ________________________ Sub ArrayFunction() Dim VA as Variant VA = Array(tom,1,date$) End Sub

18 Watch The Variables LOCALS WINDOW - keep track of variable values in local procedure WATCH WINDOW - keep track of variable values in all procedures IMMEDIATE WINDOW - keep track of variable values with debug.print or ?