VBA: A BRIEF INTRODUCTION SEAMUS STEGENGA MEEN 381-506 FEBRUARY 11, 2015.

Slides:



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

DriveWorks – Product Configurator
© Paradigm Publishing, Inc Excel 2013 Level 2 Unit 2Managing and Integrating Data and the Excel Environment Chapter 7Automating Repetitive Tasks.
Chapter 1 - VB 2008 by Schneider1 Chapter 1 - An Introduction to Computers and Problem Solving 1.1 An Introduction to Computers 1.2 Windows, Folders, and.
Web ADI - Srinivas.M. Purpose Data upload into Oracle Applications Solution: Web ADI brings Oracle E-Business Suite functionality to a spreadsheet, where.
Using Macros and Visual Basic for Applications (VBA) with Excel
Tutorial 7: Developing an Excel Application
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.
Introduction to Excel Chapter 2 Excel Fundamentals Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Templates and Styles Excel Advanced. Templates are pre- designed and formatted spreadsheets –They provide consistency of layout/structure –They.
Microsoft Office Excel 2013 Core Microsoft Office Excel 2013 Core Courseware # 3253 Lesson 8: Macros, Importing and Exporting Data.
MACROS CS1100 Computer Science and its Applications CS11001.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Copyright 2003, Paradigm Publishing Inc. CHAPTER 6 BACKNEXTEND 6-1 LINKS TO OBJECTIVES Create and Rename a Folder Create and Rename a Folder Delete Workbooks.
Customizing Word Microsoft Office Word 2007 Illustrated Complete.
Professor Joe Perret Pierce College Transition to Microsoft Office 2007.
CS&E 1111 PowerPoint Microsoft PowerPoint Learning about Presentation Software and using Microsoft PowerPoint Slide views Preparing text, drawings and.
Computers They're Not Magic! (for the most part)‏ Adapted from Ryan Moore.
Adding Automated Functionality to Office Applications.
PROCAL MULTI DISCIPLINE CALIBRATION SOFTWARE CALIBRATION PROCEDURE MANAGEMENT CONFIGURATION & CUSTOMISATION STAND-ALONE CERTIFICATE PRINTING.
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.
Computer Science & Engineering 2111 Data Validation and Macros 1 CSE 2111 Lecture-Data Validation and Macros.
Introduction to VBA. This is not Introduction to Excel We’re going to assume you have a basic level of familiarity with Excel If you don’t, or you need.
NAWD National Conference on Student Activities – 2009 can produce Yip-pees! Saturday December 5, 2009 – Fort Lauderdale, FL Lou Miller – Executive Director,
Introduction to VBA. What is VBA? VBA stands for Visual Basic for Applications. It is a programming language used exclusively by the Microsoft Office.
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.
| | Tel: | | Computer Training & Personal Development Microsoft Office PowerPoint 2007 Expert.
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-
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)
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.
Microsoft Outlook 2007 Basics Distance Learning (860) 343 – 5756 Chapman 633/632 Middlesex Community College Visit
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.
Exploring Microsoft Office XP - Microsoft Word 2002 Chapter 71 Exploring Microsoft Word Chapter 7 The Expert User: Workgroups, Forms, Master Documents,
· Adding and Renaming Worksheets
A Comparison of SAS versus Microsoft Excel and Access’s Inbuilt VBA Functionality Jozef Tarrant, Amadeus Software Ltd. 1 Copyright © 2011 Amadeus Software.
Computer Science & Engineering 2111 Lecture 9 Data Validation, Worksheet Protection, and Macros 1CSE Data Validation and Macros.
Automating Database Processing
Key Applications Module Lesson 21 — Access Essentials
Chapter 17 Creating a Database.
© Paradigm Publishing Inc. 5-1 Chapter 5 Application Software.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Introduction to Microsoft Excel Macros COE 201- Computer Proficiency.
MS Excel Lesson 1. Starting Excel Excel opens to a list of templates and in most cases you choose Blank workbook or open a previous file. Think of a workbook.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Microsoft Excel Consolidation. Contents Introduction to Multiple Workbook Applications Working with Multiple Workbook Applications using normal keyboard.
9.1 The Need for Integrating Data among Different Types of Software Tasks of composing a project.
Excel Tutorial 8 Developing an Excel Application
SECTION 1: Add-ons to PowerPoint
Outline In this module, the following topics will be covered:
Instructor Name Instructor Title Library Name
Microsoft Access Illustrated
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Exploring Microsoft® Word® 2016 Series Editor Mary Anne Poatsy
Microsoft® Office Word 2007 Training
Data Validation, Worksheet Protection, and Macros
Exploring Microsoft Excel
Microsoft Office Excel 2003
Microsoft Office Illustrated Fundamentals
Lab 08 Introduction to Spreadsheets MS Excel
Tutorial 11 Using and Writing Visual Basic for Applications Code
Microsoft Excel 2007 – Level 2
Presentation transcript:

VBA: A BRIEF INTRODUCTION SEAMUS STEGENGA MEEN FEBRUARY 11, 2015

OVERVIEW  Introduction…………… 1 slide  History………………… 2 slides  Hypothetical example… 10 slides  Real-world example…… 2 slides  Pros and cons ………… 1 slide  Conclusion …………… 1 slide  Questions……………… 1 slide

INTRODUCTION  VBA is a proprietary object-oriented programming language developed by Microsoft  It is built in to MS office installations  (Anyone with Excel already has it installed on their computer)  It allows users to automate tasks, manipulate large data sets, and create custom interfaces

HISTORY  Early computing had many programming languages  Problem: steep learning curve  In 1975, Bill Gates dropped out of Harvard to create an interpreter for BASIC  Product was instant success, becoming the central product of his company, Microsoft  Independently, VisiCal, the first spreadsheet program, was created in 1978  It was also an instant success, becoming the first “killer app” and substantially boosting PC sales  Lotus soon followed, becoming the dominate entry in the spreadsheet market  Microsoft tried to compete with Microplan (predecessor to Excel), but generally failed to gain market share

HISTORY  15 years later, Microsoft was still struggling to gain market share  Then, in 1993, Microsoft combined its BASIC interpreter with Excel  The result was VBA, an object-oriented language centered around the MS office suite  VBA-based Excel was successful beyond even Microsoft’s expectations,  Lotus lost dominate market position in 1995 and was bought by IBM later that year  Since then, Excel has become a de-facto standard in business settings (especially engineering)

EXAMPLE: PROBLEM STATEMENT  Suppose that on a particular project, your boss tells you to check which AutoCAD drawings have been updated and need to be re-sent to the client. They give you a list of drawings, the current revision of each drawing, and a list of filenames that have already been sent.  Which drawings need to be resent? DRAWINGREVFILENAME AG GAE1.2AG GAE rev 1.2.DWG AG GAE1AG GAErev1.0.dwg AG GAE1.2AG GAErev1.2.dwg AG GAE1.1AG GAE_1.1.DWG AG GAE1.2AG GAErev1.1.dwg AG GAE1.2AG GAE Rev1.2.dwg AG GAE1AG GAE Rev1 AG GAE1.1AG GAE Rev1.1.dwg AG GAE1AG GAE_1.0.DWG AG GAE1AG GAE_1.0.DWG AG GAE1.1AG GAE Rev1.1.dwg AG GAE2AG GAE Rev1.2 AG GAE1AG GAE_1.DWG AG GAE2AG GAE rev 2.dwg AG GAE1AG GAE rev1.0.dwg AG GAE1AG GAE_1 AG GAE1AG GAErev1.0.DWG AG GAE1AG GAErev1.0.DWG AG GAE1.2AG GAE rev 1.2 AG GAE1AG GAE rev 1.0.DWG AG GAE1AG GAErev1 AG GAE1.1AG GAE Rev1.1.dwg AG GAE1AG GAE rev1 AG GAE1.2AG GAE Rev1.2.dwg AG GAE2AG GAErev2.dwg

EXAMPLE: PROBLEM STATEMENT  Suppose that on a particular project, your boss tells you to check which AutoCAD drawings have been updated and need to be re-sent to the client. They give you a list of drawings, the current revision of each drawing, and a list of filenames that have already been sent.  Which drawings need to be resent? DRAWINGREVFILENAME AG GAE1.2AG GAE rev 1.2.DWG AG GAE1AG GAErev1.0.dwg AG GAE1.2AG GAErev1.2.dwg AG GAE1.1AG GAE_1.1.DWG AG GAE1.2AG GAErev1.1.dwg AG GAE1.2AG GAE Rev1.2.dwg AG GAE1AG GAE Rev1 AG GAE1.1AG GAE Rev1.1.dwg AG GAE1AG GAE_1.0.DWG AG GAE1AG GAE_1.0.DWG AG GAE1.1AG GAE Rev1.1.dwg AG GAE2AG GAE Rev1.2 AG GAE1AG GAE_1.DWG AG GAE2AG GAE rev 2.dwg AG GAE1AG GAE rev1.0.dwg AG GAE1AG GAE_1 AG GAE1AG GAErev1.0.DWG AG GAE1AG GAErev1.0.DWG AG GAE1.2AG GAE rev 1.2 AG GAE1AG GAE rev 1.0.DWG AG GAE1AG GAErev1 AG GAE1.1AG GAE Rev1.1.dwg AG GAE1AG GAE rev1 AG GAE1.2AG GAE Rev1.2.dwg AG GAE2AG GAErev2.dwg

EXAMPLE: SOLUTION  Pressing Alt+F11 pulls up the VBA editor

EXAMPLE: SOLUTION  Double clicking “ThisWorkbook” brings up a white text editor

EXAMPLE: SOLUTION  Typing “Sub example_name” and pressing enter creates a new sub-routine  Code is automatically color-coded as you type

EXAMPLE: SOLUTION  Write your macro  cells(2,3).value => value of cell C2  UCase(“string”) => “STRING”  Right(“string”,4) => “ring”  CDec(“1.49”) => 1.49  Replace(“i pie”,”i”,”U”) => “U pUe”  Typing the function name and open parenthesis will make a tooltip pop up, telling you what inputs the function is expecting. This is very useful!  Most functions can be found using online search

EXAMPLE: SOLUTION  Clicking the green triangle on the top window executes the macro (can also start by pressing F5)  Afterwards, the Excel pane looks like the following DRAWINGREVFILENAMES AG GAE1.2AG GAE rev 1.2.DWG AG GAE1AG GAErev1.0.dwg AG GAE1.2AG GAErev1.2.dwg AG GAE1.1AG GAE_1.1.DWG AG GAE1.2different!AG GAErev1.1.dwg AG GAE1.2AG GAE Rev1.2.dwg AG GAE1AG GAE Rev1 AG GAE1.1AG GAE Rev1.1.dwg AG GAE1AG GAE_1.0.DWG AG GAE1AG GAE_1.0.DWG AG GAE1.1AG GAE Rev1.1.dwg AG GAE2different!AG GAE Rev1.2 AG GAE1AG GAE_1.DWG AG GAE2AG GAE rev 2.dwg AG GAE1AG GAE rev1.0.dwg AG GAE1AG GAE_1 AG GAE1AG GAErev1.0.DWG AG GAE1AG GAErev1.0.DWG AG GAE1.2AG GAE rev 1.2 AG GAE1AG GAE rev 1.0.DWG AG GAE1AG GAErev1 AG GAE1.1AG GAE Rev1.1.dwg AG GAE1AG GAE rev1 AG GAE1.2AG GAE Rev1.2.dwg AG GAE2AG GAErev2.dwg

EXAMPLE: ADDING FEATURES  If desired, you can also make Excel relay information using a variety of pop-ups  For example, 9 lines were added to the previous code, as shown on right

EXAMPLE: ADDING FEATURES  If desired, you can also make Excel relay information using a variety of pop-ups  For example, 9 lines were added to the previous code, as shown on right  The result is a text pop-up listing the out- of-date drawings  This can be copied directly into Outlook!

EXAMPLE: FINAL WORD  VBA is helpful with: Large data sets Repetitive tasks Interacting with other programs Removing sheet protection Hiding formulas Dynamic links to external files

REAL-WORLD EXAMPLE Real-world example: BOM => requisition forms

REAL-WORLD EXAMPLE  Without VBA:  Sort by manufacturer  Copy data, paste without formatting  Each copy-paste repeated ~15 times per BOM  Error prone  With VBA:  Single button added to ribbon  A single click creates and saves one requisition form per vendor  Fast and low error rate  Furthermore, errors are not the kinds that “slip through the cracks” 4 hour process => 5 minute process!

AUTOMATING EXCEL: PROS AND CONS PROS Completes complex tasks quickly Allows for greater control over Excel Reduces errors CONS Large initial time investment Typically not flexible Encourages overreliance on technology

CONCLUSION  VBA  is an important part of Microsoft’s history  can speed up repetitive tasks and add features to Excel  is easy to learn and has a helpful online community  requires a large initial time investment but can save hundreds of man-hours!

REFERENCES  "Is Visual Basic That Basic?" What Is Visual Basic? Software Engineer Insider, Nov Web. 11 Feb  Martin, Kipp. "Introduction to VBA." University of Chicago: Booth School of Business (2012): n. pag. 4 Jan Web. 11 Feb  Power, D. J. "A Brief History of Spreadsheets." DSSResources.com, 30 Aug Web. 11 Feb

QUESTIONS ?

?

?

?

?

?

?

?

?

?

?

?