Excel VBA Day 3 of 3 Tom Vorves.

Slides:



Advertisements
Similar presentations
Using VB with MS Applications R. Juhl, Delta College.
Advertisements

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.
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.
Week 10.  Protecting Code  Protecting Worksheets  Error Handling  Charts.
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.
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.
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.
How to get started with Excel VBA. We need to enable programming in Excel  the “Developer menu”
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Excel and VBA Creating an Excel Application
Exploring Office Grauer and Barber 1 Creating More Powerful Applications: Introduction to VBA(Wk9)
Visual Basic for Applications Class III. User Forms  We place controls on User Forms to get input from the user.  Common controls include text boxes,
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
VBA & Excel Barry L. Nelson IEMS 465 Fall Quarter 2003.
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.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #2: The Visual Basic Editor The Visual Basic for Applications Programming Language IE 212: Computational.
With Microsoft Excel 2007 Comprehensive 1e© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2007 Comprehensive.
University of Toronto at Scarborough © Andria Hunter, Kersti Wain-Bantin CSCA01 VBA-3 1 Lecture Outline Variable Scope Calling another subprogram Programming.
Project 9 Using Visual Basic for Applications (VBA) to Customize and Automate Excel Jason C. H. Chen, Ph.D. Professor of Management Information Systems.
Microsoft Excel 2007 © Wiley Publishing All Rights Reserved. The L Line The Express Line to Learning L Line.
VBA for Excel. What is a spreadsheet? u An Excel spreadsheet is a set of worksheets  Each worksheets is made up of rows and columns of cells  Rows are.
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.
Ch 11: Userforms CP212 Winter Topics Designing User Forms o Controls Setting Properties o Tab Order o Testing Writing Event Handlers o Userform_Initialize.
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.
OV Copyright © 2011 Element K Content LLC. All rights reserved.  Create a Macro with the Macro Recorder  Edit a Macro  Debug a Macro  Customize.
An Introduction to Visual Basic
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.
Intro to Excel - Session 7.31 Tutorial 7 - Session 7.3 Developing an Excel Application.
Excel VBA TOM VORVES DO THE ACTIVITY EXERCISE ON PAGE 53 IF YOU WISH ElaineNikky JennArrinMylinh Matt Move Row.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
Chapter 9 Macros And Visual Basic For Applications.
Chapter 11: Introduction to VBA Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Introduction to Excel VBA UNC Charlotte CPE/PDH Series December 17, 2009.
CompMathBSc, English 5 October 2006 Programming basics — continued  Arrays  Cycle Statements: Loops  Control Structures vs Conditions  Subs: Procedures.
Understanding Visual Basic Fundamentals CHAPTER 13 Understanding Visual Basic Fundamentals.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
Lecture 6 – Working with VBA Sub Procedures Dr Joanna Wyrobek 1.
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.
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:
VBA - Excel VBA is Visual Basic for Applications
VBA - Excel VBA is Visual Basic for Applications
Innovative Technology Solutions
1. Introduction to Visual Basic
Even More VBA IE 469 Spring 2017.
Microsoft Access Illustrated
Microsoft Office Illustrated
Learning Excel Session 9 and 10 Dr. Chaitali Basu Mukherji.
Introducing VBA Macros
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Visual Basic for Applications in Microsoft Excel (1)
Exploring Microsoft Excel
Debugging Visual Basic Programs
Microsoft Office Excel 2003
Custom Form with Spin Button Controls with VBA in Excel In-Class Exercise #12 Objective: Enhance a “standard” DSS interface with a custom “user form”
Tutorial 11 Using and Writing Visual Basic for Applications Code
Excel VBA Programming © Copyright 2011, TechMentors All rights reserved.
Presentation transcript:

Excel VBA Day 3 of 3 Tom Vorves

DO Loops (Conditional) Check then Do Do Until x = 10 Commands Loop Do While x <> 10 Do then Check Do Loop Until x = 10 Loop While x <> 10 For Next (Counted) For x = 1 to 10 Next x For Each (Based on a Selection) For each Cell in Selections Next Cell

Scroll down and click the Excel 2013 Programming with VBA link http://www.lo-select.com Helen: LSXMY9FPNN Matthew: LSXRSDAAGM Data files: http://www.onlc.com/data Scroll down and click the Excel 2013 Programming with VBA link

GETTING STARTED Introducing Visual Basic for Applications Displaying the Developer Tab in the Ribbon Recording a Macro Saving a Macro-Enabled Workbook Running a Macro Editing a Macro in the Visual Basic Editor Understanding the Development Environment Using Visual Basic Help Closing the Visual Basic Editor Understanding Macro Security GETTING STARTED

WORKING WITH PROCEDURES AND FUNCTIONS Understanding Modules Creating a Standard Module Understanding Procedures Creating a Sub Procedure Calling Procedures Using the Immediate Window to Call Procedures Creating a Function Procedure Naming Procedures Working with the Code Editor WORKING WITH PROCEDURES AND FUNCTIONS

UNDERSTANDING OBJECTS Navigating the Excel Object Hierarchy Understanding Collections Using the Object Browser Working with Properties Using the With Statement Working with Methods Creating an Event Procedure UNDERSTANDING OBJECTS

USING EXPRESSIONS, VARIABLES, AND FUNCTIONS Understanding Expressions and Statements Declaring Variables Understanding Data Types Working with Variable Scope Using Intrinsic Functions Understanding Constants Using Intrinsic Constants Using Message Boxes Using Input Boxes Declaring and Using Object Variables USING EXPRESSIONS, VARIABLES, AND FUNCTIONS

CONTROLLING PROGRAM EXECUTION Understanding Control-of-Flow Structures Working with Boolean Expressions Using the If...End If Decision Structures Using the Select Case...End Select Structure Using the Do...Loop Structure Using the For...To...Next Structure Using the For Each...Next Structure Guidelines for use of Control-of-Flow Structures CONTROLLING PROGRAM EXECUTION

WORKING WITH FORMS AND CONTROLS Understanding UserForms Using the Toolbox Working with UserForm Properties, Events, and Methods Understanding Controls Setting Control Properties in the Properties Window Working with the Label Control Working with the Text Box Control Working with the Command Button Control Working with the Combo Box Control Working with the Combo Box Control Working with the Frame Control Working with Option Button Controls Working with Control Appearance Setting the Tab Order Populating a Control Adding Code to Controls Launching a Form in Code WORKING WITH FORMS AND CONTROLS

WORKING WITH THE PIVOTTABLE OBJECt Understanding PivotTables Creating a PivotTable Using Worksheet Data Working with the PivotTable Objects Working with the PivotFields Collection Assigning a Macro to the Quick Access Toolbar WORKING WITH THE PIVOTTABLE OBJECt

DEBUGGING CODe Understanding Errors Using Debugging Tools Setting Breakpoints Stepping through Code Using Break Mode during Run mode Determining the Value of Expressions DEBUGGING CODe

HANDLING ERRORS Understanding Error Handling Understanding VBA's Error Trapping Options Trapping Errors with the On Error Statement Understanding the Err Object Writing an Error-Handling Routine Working with Inline Error Handling HANDLING ERRORS

exercises Message Boxes, Input Boxes, User Forms Call Sub Procedures Functions Procedures Debug with Break Points, F8 and F5 Trusted Locations: 1-24 Final Exercise Examples: 1-25 exercises

Loop through all charts Public Sub what() Dim sht As Worksheet Dim CurrentSheet As Worksheet Dim cht As ChartObject Application.ScreenUpdating = False Application.EnableEvents = False Set CurrentSheet = ActiveSheet For Each sht In ActiveWorkbook.Worksheets For Each cht In sht.ChartObjects cht.Activate 'Do something with the chart... Next cht Next sht CurrentSheet.Activate Application.EnableEvents = True End Sub Loop through all charts

Sub test()     Dim wks As Worksheet     Dim pvt As PivotTable          On Error Resume Next     For Each wks In Worksheets         For Each pvt In wks.PivotTables             pvt.PivotFields("Month").CurrentPage = Sheets("Sheet1").Range("A1").Value         Next pvt     Next wks End Sub Loop all Pivot Tables