6/14/2010. VBA program units: Subroutines and Functions. Functions: Examples: Examples:

Size: px
Start display at page:

Download "6/14/2010. VBA program units: Subroutines and Functions. Functions: Examples: Examples:"

Transcription

1 VBA program units: Subroutines and Functions Subs: a chunk of VBA code that can be executed by running it from Excel, from the VBE, or by being called by another VBA subprogram can be created with the macro recorder or typed in from scratch may have zero-to-several arguments that provide for values to be input to or output from the Sub Sub name (optional arguments) Functions: a VBA subprogram that can be executed by using its name in a VBA expression or an Excel formula functions can return values functions cannot be recorded, but must be typed into the VBE functions may have zero-to-several input arguments Function name (optional arguments) End Function End Sub 1 2 Examples: Examples: Function Twice(mynumber) Twice = 2*mynumber End Function Function Icy(temp) If (temp <= 32) Then MsgBox ("Yes") Icy = temp End Function Sub hello() MsgBox ("Hello") too End Sub MsgBox Hello would work here 3 4 1

2 Declaring variables When you write VBA code, it is possible to get away without declaring the data types of variables that you use. But, this is bad programming practice, so it is best to declare the types of all variables used in VBA: Dim <variable-name> As <type> This requirement is enforced by putting the Option Explicit statement at the top of every VBA module you develop. Making VBA work Save As Macro-Enabled workbook (.xlsm) Make sure Options -> Trust Settings is allowing macros Make a new directory for each VBA/Excel workbook (clarity) Functions: test by calling in Excel worksheet (or from Sub) Allowed to return values Multiple arguments possible Subs: test by running with F8 in VBE Allowed to change cells Multiple arguments possible Check settings by loading Kick Calculator; should run! 5 6 Enforcing variable declaration put Option Explicit statement at the top of every module or set VBE s Tools and VBE will do it for you! Options Require Variable Declaration Object-oriented programming Objects : entities that have attributes ( properties ) that can be manipulated These are generally organized in hierarchies: The object that corresponds to cell A1 Selection Excel Word Microsoft Office 7 Application Objects in red 8 2

3 Object Collections Workbooks all currently-open workbook objects Worksheets all sheets contained in a particular workbook Charts all charts contained in a particular workbook Object-oriented Programming & Variable Scope Referring to objects in a collection Worksheets( Main ) Charts( XY ) Workbook Worksheet Chart Z Y Y X Complete object references Application.Workbooks( Project6 ).Worksheets( Main ).Range( B16 ) Can be simplified when unambiguous Workbooks( Project6 ).Worksheets( Main ).Range( B16 ) X Worksheets( Main ).Range( B16 ) Range( B16 ) 9 10 The SCOPE of a variable How far is the reach of the variable, or from where can the variable be seen? 1) only within a single procedure (Sub or Function) such a variable is generally called a local variable variable is declared using a Dim statement within the procedure 2) only within the current module a module variable declared using a Dim statement before the first Sub or Function in the module 3) everywhere, in all procedures, in all modules open declared using a Public statement at the module level 11 Module 1 Module 2 Dim k As Integer Public R As Single One Dolt Two Howdy Current Workbook/ VBA project 12 3

4 Where can k be referenced? Where can R be referenced? a) Everywhere in Module 1 a) Only Module 1 b) Everywhere in Module 2 b) Only Module 2 c) Anywhere not in Function Dolt c) Only Function Dolt d) Only in Sub howdy d) Only Sub howdy e) Everywhere 13 e) Everywhere 14 Where can y be referenced? Where can j be referenced? a) Only Module 1 a) Only Module 1 b) Function Two and Function Dolt b) Only Module 2 c) Only Function Two c) Only Sub Howdy d) Only Sub Howdy d) Only Function Two e) Everywhere 15 e) Everywhere 16 4

5 Static & Constant Static is used, instead of Dim, when you want the variable to retain its value after the procedure is finished i.e., if you want the variable to have the same value the next time the procedure is run. Static y as Single Symbolic constants can be used to store values with names, where the values should never change. Use the Const keyword for this: Const Rgas As Single = How to invoke Excel spreadsheet functions from VBA: Application.WorksheetFunction.function-name (arguments) Example: creating a function RangeArray uses Min and Max functions in Excel, not available in VBA

6 UserForms UserForms Insert a UserForm in the Visual Basic Editor (VBE) 1) Design it 2) Set up code that processes what the user types into the boxes & clicks on the radio buttons 3) Hook that code to the Compute Re button 4) Set up code that quits & hook it to the Quit button 5) Set up a way to bring up the form 21 Toolbox contains stuff to put on form New & empty form 22 Properties Setting up the name and caption: A user form is a variable and needs a name (like any variable). The Properties window (in the bottom left corner of the VBE) lists properties of the selected object here, the userform. The Name is how you will refer to the form. The Caption is a property of the form what the user sees in the top of the form: Use it to set those properties

7 Add title and field for density Add textbox for value Properties window now refers to the label object Change caption: It s essential to name the textbox since that value will be taken from the user and used in the program. You don t need to change the Name since we re not going to be modifying the label in our program. The Caption is what s displayed on the User Form Add a frame to contain the units choices: Add an option button in the frame for one units choice Frames used to group similar objects. Exclusive OR Must be large enough to include all of the choices you want to provide. Feel free to remove the caption for aesthetic reasons (just remove the text in here) 27 stretch button so caption shows: change title & caption: Again, option buttons MUST be named as that name will be used in your code. 28 7

8 Change default button value to true: Add similar entries for pipe diameter, velocity and viscosity: add button for alternate units with caption and default false: Easiest way: just copy each row and change the names and captions in the corresponding Properties window Add a command button to compute the answer: Change command button name, caption & font: 31 The name of the command button is the name of the VBA subroutine that performs the calculation 32 8

9 Add a Quit button with similar formatting Hooking things up The UserForm is now complete, but two important features are missing: The name of that button is also used in your program. 1) there is no way for the UserForm to appear for use 2) when the Compute and Quit buttons are clicked, nothing will happen because there is no VBA code behind them Hooking VBA code to the Compute Re button Filling in that code: Double-click the Compute Re button. This will cause the following Sub wrapper to pop up in a code module: In here, we must add code to carry out the necessary calculations and display the Reynolds Number result convert units, as required compute the Reynolds Number display the result

10 This variable is the name you created for your textbox What is the variable that VBA uses to return whatever the user types here? Do NOT use the textbox name on the LHS of your calculation it will not work!! This is a variable you create and use in your calculation. 37 a) Diam b) PipeDiameter c) Pipe Diameter 38 What variable does this Sub use in its calculations for this? What is the variable that VBA uses to return whatever the user types here? a) Diam b) PipeDiameter c) Pipe Diameter 39 a) mu b) viscosity c) fluid viscosity 40 10

11 How to run and remove user forms insert a new module and add this Sub to start the UserForm double-click the Quit button and add the code to remove ( unload ) the UserForm run the StartReynoldsNumber macro and enter values with units selected UserForms UserForms can be loaded automatically when the workbook is opened. (This is called an event handler. ) And they can also be unloaded automatically when the workbook is closed. 1. Go to VBE and double click on thisworkbook item in Project Explorer. (If Project Explorer doesn t show up, use view) 2. Change left field at top from General to Workbook. 3. Type in ReynoldsNumber.Show (this is not on any exam; it s just a useful FYI) Things to Remember!!! Create your own variables to carry out calculations, NOT the variables in the user form Make sure the variables from the user form that you assign to your created variables are the same names as in your user form These variables are those used from your text boxes and your option buttons, NOT your labels You should not have the same name for your text box as for your label 43 This variable is the name you created for your option button FormatNumber number of digits after the decimal point. Does not round

12 If you get a Reynolds number of and the program says MsgBox(FormatNumber(Re,1)), what will the message box say? a) 2134 b) 2135 c) d) e) MsgBox Function MsgBox( prompt,buttons, title,helpfile,context) optional MsgBox Function MsgBox( prompt,buttons, title,helpfile,context) optional MsgBox Function Button codes vbokonly vbokcancel vbabortretryignore vbyesnocancel vbyesno vbretrycancel vbcritical vbquestion vbexclamation vbinformation vbdefaultbutton1 vbdefaultbutton2 vbdefaultbutton3 vbdefaultbutton4 vbsystemmodal MsgBox result is button clicked by user Putting line breaks into the message displayed:

Excel & Visual Basic for Applications (VBA)

Excel & Visual Basic for Applications (VBA) Class meeting #18 Monday, Oct. 26 th GEEN 1300 Introduction to Engineering Computing Excel & Visual Basic for Applications (VBA) user interfaces o on-sheet buttons o InputBox and MsgBox functions o userforms

More information

Understanding the MsgBox command in Visual Basic

Understanding the MsgBox command in Visual Basic Understanding the MsgBox command in Visual Basic This VB2008 tutorial explains how to use the MsgBox function in Visual Basic. This also works for VBS MsgBox. The MsgBox function displays a message in

More information

An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is

An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is InputBox( ) Function An InputBox( ) function will display an input Box window where the user can enter a value or a text. The format is A = InputBox ( Question or Phrase, Window Title, ) Example1: Integer:

More information

variables programming statements

variables programming statements 1 VB PROGRAMMERS GUIDE LESSON 1 File: VbGuideL1.doc Date Started: May 24, 2002 Last Update: Dec 27, 2002 ISBN: 0-9730824-9-6 Version: 0.0 INTRODUCTION TO VB PROGRAMMING VB stands for Visual Basic. Visual

More information

MICROSOFT EXCEL 2000 LEVEL 5 VBA PROGRAMMING INTRODUCTION

MICROSOFT EXCEL 2000 LEVEL 5 VBA PROGRAMMING INTRODUCTION MICROSOFT EXCEL 2000 LEVEL 5 VBA PROGRAMMING INTRODUCTION Lesson 1 - Recording Macros Excel 2000: Level 5 (VBA Programming) Student Edition LESSON 1 - RECORDING MACROS... 4 Working with Visual Basic Applications...

More information

BASIC EXCEL SYLLABUS Section 1: Getting Started Section 2: Working with Worksheet Section 3: Administration Section 4: Data Handling & Manipulation

BASIC EXCEL SYLLABUS Section 1: Getting Started Section 2: Working with Worksheet Section 3: Administration Section 4: Data Handling & Manipulation BASIC EXCEL SYLLABUS Section 1: Getting Started Unit 1.1 - Excel Introduction Unit 1.2 - The Excel Interface Unit 1.3 - Basic Navigation and Entering Data Unit 1.4 - Shortcut Keys Section 2: Working with

More information

Download the files from you will use these files to finish the following exercises.

Download the files from  you will use these files to finish the following exercises. Exercise 6 Download the files from http://www.peter-lo.com/teaching/x4-xt-cdp-0071-a/source6.zip, you will use these files to finish the following exercises. 1. This exercise will guide you how to create

More information

IFA/QFN VBA Tutorial Notes prepared by Keith Wong

IFA/QFN VBA Tutorial Notes prepared by Keith Wong Chapter 2: Basic Visual Basic programming 2-1: What is Visual Basic IFA/QFN VBA Tutorial Notes prepared by Keith Wong BASIC is an acronym for Beginner's All-purpose Symbolic Instruction Code. It is a type

More information

Excel Programming with VBA (Macro Programming) 24 hours Getting Started

Excel Programming with VBA (Macro Programming) 24 hours Getting Started Excel Programming with VBA (Macro Programming) 24 hours Getting Started Introducing Visual Basic for Applications Displaying the Developer Tab in the Ribbon Recording a Macro Saving a Macro-Enabled Workbook

More information

Unit 9 Spreadsheet development. Create a user form

Unit 9 Spreadsheet development. Create a user form Unit 9 Spreadsheet development Create a user form So far Unit introduction Learning aim A Features and uses Assignment 1 Learning aim B - Design a Spreadsheet Assignment 2 Learning aim C Develop and test

More information

Programming Concepts and Skills. Arrays continued and Functions

Programming Concepts and Skills. Arrays continued and Functions Programming Concepts and Skills Arrays continued and Functions Fixed-Size vs. Dynamic Arrays A fixed-size array has a limited number of spots you can place information in. Dim strcdrack(0 to 2) As String

More information

Getting started 7. Writing macros 23

Getting started 7. Writing macros 23 Contents 1 2 3 Getting started 7 Introducing Excel VBA 8 Recording a macro 10 Viewing macro code 12 Testing a macro 14 Editing macro code 15 Referencing relatives 16 Saving macros 18 Trusting macros 20

More information

This chapter is intended to take you through the basic steps of using the Visual Basic

This chapter is intended to take you through the basic steps of using the Visual Basic CHAPTER 1 The Basics This chapter is intended to take you through the basic steps of using the Visual Basic Editor window and writing a simple piece of VBA code. It will show you how to use the Visual

More information

LmÉPï C Á npï À ƵÀ ïì itech Analytic Solutions

LmÉPï C Á npï À ƵÀ ïì itech Analytic Solutions LmÉPï C Á npï À ƵÀ ïì itech Analytic Solutions No. 9, 1st Floor, 8th Main, 9th Cross, SBM Colony, Brindavan Nagar, Mathikere, Bangalore 560 054 Email: itechanalytcisolutions@gmail.com Website: www.itechanalytcisolutions.com

More information

MgtOp 470 Business Modeling with Spreadsheets Sample Midterm Exam. 1. Spreadsheets are known as the of business analysis.

MgtOp 470 Business Modeling with Spreadsheets Sample Midterm Exam. 1. Spreadsheets are known as the of business analysis. Section 1 Multiple Choice MgtOp 470 Business Modeling with Spreadsheets Sample Midterm Exam 1. Spreadsheets are known as the of business analysis. A. German motor car B. Mexican jumping bean C. Swiss army

More information

DATA 301 Introduction to Data Analytics Microsoft Excel VBA. Dr. Ramon Lawrence University of British Columbia Okanagan

DATA 301 Introduction to Data Analytics Microsoft Excel VBA. Dr. Ramon Lawrence University of British Columbia Okanagan DATA 301 Introduction to Data Analytics Microsoft Excel VBA Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca DATA 301: Data Analytics (2) Why Microsoft Excel Visual Basic

More information

Advanced Financial Modeling Macros. EduPristine

Advanced Financial Modeling Macros. EduPristine Advanced Financial Modeling Macros EduPristine www.edupristine.com/ca Agenda Introduction to Macros & Advanced Application Building in Excel Introduction and context Key Concepts in Macros Macros as recorded

More information

MS Excel VBA Class Goals

MS Excel VBA Class Goals MS Excel VBA 2013 Class Overview: Microsoft excel VBA training course is for those responsible for very large and variable amounts of data, or teams, who want to learn how to program features and functions

More information

Excel 2016: Introduction to VBA

Excel 2016: Introduction to VBA Excel 2016: Introduction to VBA In the previous Excel courses, you used Excel to simplify business tasks, including the creation of spreadsheets, graphs, charts, and formulas that were difficult to create

More information

MICROSOFT EXCEL VISUAL BASIC FOR APPLICATIONS INTERMEDIATE

MICROSOFT EXCEL VISUAL BASIC FOR APPLICATIONS INTERMEDIATE MICROSOFT EXCEL VISUAL BASIC FOR APPLICATIONS INTERMEDIATE NOTE Unless otherwise stated, screenshots of dialog boxes and screens in this book were taken using Excel 2003 running on Window XP Professional.

More information

Introduction... 1 Part I: Getting Started with Excel VBA Programming Part II: How VBA Works with Excel... 31

Introduction... 1 Part I: Getting Started with Excel VBA Programming Part II: How VBA Works with Excel... 31 Contents at a Glance Introduction... 1 Part I: Getting Started with Excel VBA Programming... 9 Chapter 1: What Is VBA?...11 Chapter 2: Jumping Right In...21 Part II: How VBA Works with Excel... 31 Chapter

More information

Contents. Some Basics Simple VBA Procedure (Macro) To Execute The Procedure Recording A Macro About Macro Recorder VBA Objects Reference

Contents. Some Basics Simple VBA Procedure (Macro) To Execute The Procedure Recording A Macro About Macro Recorder VBA Objects Reference Introduction To VBA Contents Some Basics Simple VBA Procedure (Macro) To Execute The Procedure Recording A Macro About Macro Recorder VBA Objects Reference Some Basics Code: You perform actions in VBA

More information

The For Next and For Each Loops Explained for VBA & Excel

The For Next and For Each Loops Explained for VBA & Excel The For Next and For Each Loops Explained for VBA & Excel excelcampus.com /vba/for-each-next-loop/ 16 Bottom line: The For Next Loops are some of the most powerful VBA macro coding techniques for automating

More information

3 IN THIS CHAPTER. Understanding Program Variables

3 IN THIS CHAPTER. Understanding Program Variables Understanding Program Variables Your VBA procedures often need to store temporary values for use in statements and calculations that come later in the code. For example, you might want to store values

More information

LSP 121. LSP 121 Math and Tech Literacy II. Topics. More VBA. More VBA. Variables

LSP 121. LSP 121 Math and Tech Literacy II. Topics. More VBA. More VBA. Variables Greg Brewster, DePaul University Page 1 Math and Tech Literacy II Greg Brewster DePaul University Topics More Visual Basic Variables Naming Rules Implicit vs. Explicit Types Variable Lifetime Static variables

More information

Microsoft Excel. Good day All,

Microsoft Excel. Good day All, Microsoft Excel Good day All, I am Vikas, Excel professional and experts in developing Excel models to recognized best practice standards. Importantly, I am also a business consultant and therefore understand

More information

CSE 123 Introduction to Computing

CSE 123 Introduction to Computing CSE 123 Introduction to Computing Lecture 6 Programming with VBA (Projects, forms, modules, variables, flowcharts) SPRING 2012 Assist. Prof. A. Evren Tugtas Starting with the VBA Editor Developer/Code/Visual

More information

Read More: Index Function Excel [Examples, Make Dynamic Range, INDEX MATCH]

Read More: Index Function Excel [Examples, Make Dynamic Range, INDEX MATCH] You can utilize the built-in Excel Worksheet functions such as the VLOOKUP Function, the CHOOSE Function and the PMT Function in your VBA code and applications as well. In fact, most of the Excel worksheet

More information

DOWNLOAD PDF EXCEL MACRO TO PRINT WORKSHEET TO

DOWNLOAD PDF EXCEL MACRO TO PRINT WORKSHEET TO Chapter 1 : All about printing sheets, workbook, charts etc. from Excel VBA - blog.quintoapp.com Hello Friends, Hope you are doing well!! Thought of sharing a small VBA code to help you writing a code

More information

BASIC MACROINSTRUCTIONS (MACROS)

BASIC MACROINSTRUCTIONS (MACROS) MS office offers a functionality of building complex actions and quasi-programs by means of a special scripting language called VBA (Visual Basic for Applications). In this lab, you will learn how to use

More information

Customizing the Excel 2013 program window. Getting started with Excel 2013

Customizing the Excel 2013 program window. Getting started with Excel 2013 Customizing the Excel 2013 program window 1 2 Getting started with Excel 2013 Working with data and Excel tables Creating workbooks Modifying workbooks Modifying worksheets Merging and unmerging cells

More information

Corporate essentials

Corporate essentials Microsoft Office Excel 2016, Corporate essentials A comprehensive package for corporates and government organisations Knowledge Capital London transforming perfomance through learning MS OFFICE EXCEL 2016

More information

Programming with visual Basic:

Programming with visual Basic: Programming with visual Basic: 1-Introdution to Visual Basics 2-Forms and Control tools. 3-Project explorer, properties and events. 4-make project, save it and its applications. 5- Files projects and exercises.

More information

Excel Macro Record and VBA Editor. Presented by Wayne Wilmeth

Excel Macro Record and VBA Editor. Presented by Wayne Wilmeth Excel Macro Record and VBA Editor Presented by Wayne Wilmeth 1 What Is a Macro? Automates Repetitive Tasks Written in Visual Basic for Applications (VBA) Code Macro Recorder VBA Editor (Alt + F11) 2 Executing

More information

VBA. VBA at a glance. Lecture 61

VBA. VBA at a glance. Lecture 61 VBA VBA at a glance Lecture 61 1 Activating VBA within SOLIDWORKS Lecture 6 2 VBA Sub main() Function Declaration Dim A, B, C, D, E As Double Dim Message, Title, Default Message = "A : " ' Set prompt.

More information

Civil Engineering Computation

Civil Engineering Computation Civil Engineering Computation First Steps in VBA Homework Evaluation 2 1 Homework Evaluation 3 Based on this rubric, you may resubmit Homework 1 and Homework 2 (along with today s homework) by next Monday

More information

Never Give Up Page 1

Never Give Up Page 1 VISUAL BASIC FOR APPLICATIONS (VBA) & MACROS TRAINING: Microsoft Visual Basic for Applications (VBA, Macros) when used with Microsoft Excel can build powerful automated business tools quickly and with

More information

ENGG1811 Computing for Engineers Week 9 Dialogues and Forms Numerical Integration

ENGG1811 Computing for Engineers Week 9 Dialogues and Forms Numerical Integration ENGG1811 Computing for Engineers Week 9 Dialogues and Forms Numerical Integration ENGG1811 UNSW, CRICOS Provider No: 00098G W9 slide 1 References & Info Chapra (Part 2 of ENGG1811 Text) Topic 21 (chapter

More information

Extending the Unit Converter

Extending the Unit Converter Extending the Unit Converter You wrote a unit converter previously that converted the values in selected cells from degrees Celsius to degrees Fahrenheit. You could write separate macros to do different

More information

Excel VBA Programming

Excel VBA Programming Exclusive Study Manual Excel VBA Programming Advanced Excel Study Notes (For Private Circulation Only Not For Sale) 7208669962 8976789830 (022 ) 28114695 www.laqshya.in info@laqshya.in Study Notes Excel

More information

Microsoft Excel Level 2

Microsoft Excel Level 2 Microsoft Excel Level 2 Table of Contents Chapter 1 Working with Excel Templates... 5 What is a Template?... 5 I. Opening a Template... 5 II. Using a Template... 5 III. Creating a Template... 6 Chapter

More information

EXCEL WORKSHOP III INTRODUCTION TO MACROS AND VBA PROGRAMMING

EXCEL WORKSHOP III INTRODUCTION TO MACROS AND VBA PROGRAMMING EXCEL WORKSHOP III INTRODUCTION TO MACROS AND VBA PROGRAMMING TABLE OF CONTENTS 1. What is VBA? 2. Safety First! 1. Disabling and Enabling Macros 3. Getting started 1. Enabling the Developer tab 4. Basic

More information

VBA Handout. References, tutorials, books. Code basics. Conditional statements. Dim myvar As <Type >

VBA Handout. References, tutorials, books. Code basics. Conditional statements. Dim myvar As <Type > VBA Handout References, tutorials, books Excel and VBA tutorials Excel VBA Made Easy (Book) Excel 2013 Power Programming with VBA (online library reference) VBA for Modelers (Book on Amazon) Code basics

More information

Excel VBA. Microsoft Excel is an extremely powerful tool that you can use to manipulate, analyze, and present data.

Excel VBA. Microsoft Excel is an extremely powerful tool that you can use to manipulate, analyze, and present data. Excel VBA WHAT IS VBA AND WHY WE USE IT Microsoft Excel is an extremely powerful tool that you can use to manipulate, analyze, and present data. Sometimes though, despite the rich set of features in the

More information

Introduction to VBA for Excel-Tutorial 7. The syntax to declare an array starts by using the Dim statement, such that:

Introduction to VBA for Excel-Tutorial 7. The syntax to declare an array starts by using the Dim statement, such that: Introduction to VBA for Excel-Tutorial 7 In this tutorial, you will learn deal with arrays. We will first review how to declare the arrays, then how to pass data in and how to output arrays to Excel environment.

More information

VBA Collections A Group of Similar Objects that Share Common Properties, Methods and

VBA Collections A Group of Similar Objects that Share Common Properties, Methods and VBA AND MACROS VBA is a major division of the stand-alone Visual Basic programming language. It is integrated into Microsoft Office applications. It is the macro language of Microsoft Office Suite. Previously

More information

BaSICS OF excel By: Steven 10.1

BaSICS OF excel By: Steven 10.1 BaSICS OF excel By: Steven 10.1 Workbook 1 workbook is made out of spreadsheet files. You can add it by going to (File > New Workbook). Cell Each & every rectangular box in a spreadsheet is referred as

More information

Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB

Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB Visual Programming 1. What is Visual Basic? Visual Basic is a powerful application development toolkit developed by John Kemeny and Thomas Kurtz. It is a Microsoft Windows Programming language. Visual

More information

CS 200. Lecture 07. Excel Scripting. Miscellaneous Notes

CS 200. Lecture 07. Excel Scripting. Miscellaneous Notes CS 200 Lecture 07 1 Abbreviations aka Also Known As Miscellaneous Notes CWS Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) VBE Visual Basic Editor intra- a prefix meaning within thus intra-cellular

More information

VBA Excel 2013/2016. VBA Visual Basic for Applications. Learner Guide

VBA Excel 2013/2016. VBA Visual Basic for Applications. Learner Guide VBA Visual Basic for Applications Learner Guide 1 Table of Contents SECTION 1 WORKING WITH MACROS...5 WORKING WITH MACROS...6 About Excel macros...6 Opening Excel (using Windows 7 or 10)...6 Recognizing

More information

I OFFICE TAB... 1 RIBBONS & GROUPS... 2 OTHER SCREEN PARTS... 4 APPLICATION SPECIFICATIONS... 5 THE BASICS...

I OFFICE TAB... 1 RIBBONS & GROUPS... 2 OTHER SCREEN PARTS... 4 APPLICATION SPECIFICATIONS... 5 THE BASICS... EXCEL 2010 BASICS Microsoft Excel I OFFICE TAB... 1 RIBBONS & GROUPS... 2 OTHER SCREEN PARTS... 4 APPLICATION SPECIFICATIONS... 5 THE BASICS... 6 The Mouse... 6 What Are Worksheets?... 6 What is a Workbook?...

More information

Autodesk Inventor Tutorials by Sean Dotson VBA Functions in Parts Part Two Latest Revision: 3/17/03 For R Sean

Autodesk Inventor Tutorials by Sean Dotson   VBA Functions in Parts Part Two Latest Revision: 3/17/03 For R Sean Autodesk Inventor Tutorials by Sean Dotson www.sdotson.com sean@sdotson.com VBA Functions in Parts Part Two Latest Revision: 3/17/03 For R6 2003 Sean Dotson (sdotson.com) Inventor is a registered trademark

More information

You can record macros to automate tedious

You can record macros to automate tedious Introduction to Macros You can record macros to automate tedious and repetitive tasks in Excel without writing programming code directly. Macros are efficiency tools that enable you to perform repetitive

More information

CS 200. Lecture 07. Excel Scripting. Excel Scripting. CS 200 Fall 2016

CS 200. Lecture 07. Excel Scripting. Excel Scripting. CS 200 Fall 2016 CS 200 Lecture 07 1 Abbreviations aka Also Known As Miscellaneous Notes CWS Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) VBE Visual Basic Editor intra- a prefix meaning within thus intra-cellular

More information

CS 200. Lecture 07. Excel Scripting. Miscellaneous Notes

CS 200. Lecture 07. Excel Scripting. Miscellaneous Notes CS 200 Lecture 07 1 Abbreviations aka Also Known As Miscellaneous Notes CWS Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) VBE Visual Basic Editor intra- a prefix meaning within thus intra-cellular

More information

Excel Macro Runtime Error Code 1004 Saveas Of Object _workbook Failed

Excel Macro Runtime Error Code 1004 Saveas Of Object _workbook Failed Excel Macro Runtime Error Code 1004 Saveas Of Object _workbook Failed The code that follows has been courtesy of this forum and the extensive help i received from everyone. But after an Runtime Error '1004'

More information

Outline. Midterm Review. Using Excel. Midterm Review: Excel Basics. Using VBA. Sample Exam Question. Midterm Review April 4, 2014

Outline. Midterm Review. Using Excel. Midterm Review: Excel Basics. Using VBA. Sample Exam Question. Midterm Review April 4, 2014 Midterm Review Larry Caretto Mechanical Engineering 209 Computer Programming for Mechanical Engineers April 4, 2017 Outline Excel spreadsheet basics Use of VBA functions and subs Declaring/using variables

More information

Spreadsheet Applications Test

Spreadsheet Applications Test Spreadsheet Applications Test 1. The expression returns the maximum value in the range A1:A100 and then divides the value by 100. a. =MAX(A1:A100/100) b. =MAXIMUM(A1:A100)/100 c. =MAX(A1:A100)/100 d. =MAX(100)/(A1:A100)

More information

Acknowledgments. Chapter 1: Primer in Excel VBA 1. Chapter 2: The Application Object 63

Acknowledgments. Chapter 1: Primer in Excel VBA 1. Chapter 2: The Application Object 63 Acknowledgments Introduction xxi xxiii Chapter 1: Primer in Excel VBA 1 Using the Macro Recorder 2 Recording Macros 2 Running Macros 6 The Visual Basic Editor 8 Other Ways to Run Macros 11 User-Defined

More information

Error Vba Code For Vlookup Function In Excel 2010

Error Vba Code For Vlookup Function In Excel 2010 Error Vba Code For Vlookup Function In Excel 2010 Users who use VLOOKUP or HLOOKUP function get N/A Error many times when In case, if there is a need to use these function in a Excel VBA Macro, then. Excel

More information

Microsoft Excel 2007 Macros and VBA

Microsoft Excel 2007 Macros and VBA Microsoft Excel 2007 Macros and VBA With the introduction of Excel 2007 Microsoft made a number of changes to the way macros and VBA are approached. This document outlines these special features of Excel

More information

KEYWORDS DDE GETOBJECT PATHNAME CLASS VB EDITOR WITHEVENTS HMI 1.0 TYPE LIBRARY HMI.TAG

KEYWORDS DDE GETOBJECT PATHNAME CLASS VB EDITOR WITHEVENTS HMI 1.0 TYPE LIBRARY HMI.TAG Document Number: IX_APP00113 File Name: SpreadsheetLinking.doc Date: January 22, 2003 Product: InteractX Designer Application Note Associated Project: GetObjectDemo KEYWORDS DDE GETOBJECT PATHNAME CLASS

More information

EXTENDED LEARNING MODULE M

EXTENDED LEARNING MODULE M EXTENDED LEARNING MODULE M PROGRAMMING IN EXCEL WITH VBA Student Learning Outcomes 1. Explain the value of using VBA with Excel. 2. Define a macro. 3. Build a simple macro using a Sub procedure and a Function

More information

I

I I II Disclaimer Excel VBA Made Easy is an independent publication and is not affiliated with, nor has it been authorized, sponsored, or otherwise approved by Microsoft Corporation. Trademarks Microsoft,

More information

CS 200. Lecture 05. Excel Scripting. Excel Scripting. CS 200 Fall 2014

CS 200. Lecture 05. Excel Scripting. Excel Scripting. CS 200 Fall 2014 CS 200 Lecture 05 1 Abbreviations aka CWS VBE intra- inter- Also Known As Miscellaneous Notes Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) Visual Basic Editor a prefix meaning within thus

More information

CS 200. Lecture 05! Excel Scripting. Miscellaneous Notes

CS 200. Lecture 05! Excel Scripting. Miscellaneous Notes CS 200 Lecture 05! 1 Abbreviations aka CWS VBE intra- inter- Also Known As Miscellaneous Notes Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) Visual Basic Editor a prefix meaning within thus

More information

Microsoft Excel 2010 Step-by-Step Exercises PivotTables and PivotCharts: Exercise 1

Microsoft Excel 2010 Step-by-Step Exercises PivotTables and PivotCharts: Exercise 1 Microsoft Excel 2010 Step-by-Step Exercises PivotTables and PivotCharts: Exercise 1 In this exercise you will learn how to: Create a new PivotTable Add fields to a PivotTable Format and rename PivotTable

More information

CS 200. Lecture 07. Excel Scripting. Excel Scripting. CS 200 Spring Wednesday, June 18, 2014

CS 200. Lecture 07. Excel Scripting. Excel Scripting. CS 200 Spring Wednesday, June 18, 2014 CS 200 Lecture 07 1 Miscellaneous Notes Abbreviations aka CWS VBE intra- inter- Also Known As Course Web Site (http://www.student.cs.uwaterloo.ca/~cs200) Visual Basic Editor a prefix meaning within thus

More information

1. Macro. 1.1 Overview. 1.2 Enable Developer Tab in Ribbon

1. Macro. 1.1 Overview. 1.2 Enable Developer Tab in Ribbon 1. Macro 1.1 Overview If you perform a task repeatedly in Microsoft Excel, you can automate the task with a macro. A macro is a series of commands and functions that are stored in a Microsoft Visual Basic

More information

Debugging Code in Access 2002

Debugging Code in Access 2002 0672321025 AppA 10/24/01 3:53 PM Page 1 Debugging Code in Access 2002 APPENDIX A IN THIS APPENDIX Setting the Correct Module Options for Maximum Debugging Power 2 Using the Immediate Window 6 Stopping

More information

COPYRIGHTED MATERIAL PART I. LESSON 1: Introducing VBA. LESSON 2: Getting Started with Macros. LESSON 3: Introducing the Visual Basic Editor

COPYRIGHTED MATERIAL PART I. LESSON 1: Introducing VBA. LESSON 2: Getting Started with Macros. LESSON 3: Introducing the Visual Basic Editor PART I LESSON 1: Introducing VBA LESSON 2: Getting Started with Macros LESSON 3: Introducing the Visual Basic Editor LESSON 4: Working in the VBE COPYRIGHTED MATERIAL 1 Welcome to your first lesson in

More information

Basic tasks in Excel 2013

Basic tasks in Excel 2013 Basic tasks in Excel 2013 Excel is an incredibly powerful tool for getting meaning out of vast amounts of data. But it also works really well for simple calculations and tracking almost any kind of information.

More information

Microsoft Visual Basic 2005: Reloaded

Microsoft Visual Basic 2005: Reloaded Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named

More information

Excel Advanced

Excel Advanced Excel 2016 - Advanced LINDA MUCHOW Alexandria Technical & Community College 320-762-4539 lindac@alextech.edu Table of Contents Macros... 2 Adding the Developer Tab in Excel 2016... 2 Excel Macro Recorder...

More information

Sub Programs. To Solve a Problem, First Make It Simpler

Sub Programs. To Solve a Problem, First Make It Simpler Sub Programs To Solve a Problem, First Make It Simpler Top Down Design Top Down Design Start with overall goal. Break Goal into Sub Goals Break Sub Goals into Sub Sub Goals Until the Sub-Sub Sub-Sub Sub-Sub

More information

Candy is Dandy Project (Project #12)

Candy is Dandy Project (Project #12) Candy is Dandy Project (Project #12) You have been hired to conduct some market research about M&M's. First, you had your team purchase 4 large bags and the results are given for the contents of those

More information

VBA Foundations, Part 12

VBA Foundations, Part 12 As quickly as you can Snatch the Pebble from my hand, he had said as he extended his hand toward you. You reached for the pebble but you opened it only to find that it was indeed still empty. Looking down

More information

Excel VBA Variables, Data Types & Constant

Excel VBA Variables, Data Types & Constant Excel VBA Variables, Data Types & Constant Variables are used in almost all computer program and VBA is no different. It's a good practice to declare a variable at the beginning of the procedure. It is

More information

Table of Contents COPYRIGHTED MATERIAL. Introduction Book I: Excel Basics Chapter 1: The Excel 2013 User Experience...

Table of Contents COPYRIGHTED MATERIAL. Introduction Book I: Excel Basics Chapter 1: The Excel 2013 User Experience... Table of Contents Introduction... 1 About This Book...1 Foolish Assumptions...2 How This Book Is Organized...3 Book I: Excel Basics...3 Book II: Worksheet Design...3 Book III: Formulas and Functions...4

More information

'... '... '... Developer: William H. White (consultant) '... With: TEKsystems Inc. '... For: AIG. Financial Information Systems

'... '... '... Developer: William H. White (consultant) '... With: TEKsystems Inc.   '... For: AIG. Financial Information Systems ThisWorkbook - 1 Developer: William H. White (consultant) With: TEKsystems Inc. www.teksystems.com For: AIG Financial Information Systems 1 NY Plaza, 15th floor Current contact: william.white@aig.com (212)

More information

Chapter 13 Creating a Workbook

Chapter 13 Creating a Workbook Chapter 13 Creating a Workbook Learning Objectives LO13.1: Understand spreadsheets and Excel LO13.2: Enter data in cells LO13.3: Edit cell content LO13.4: Work with columns and rows LO13.5: Work with cells

More information

DOWNLOAD PDF VBA MACRO TO PRINT MULTIPLE EXCEL SHEETS TO ONE

DOWNLOAD PDF VBA MACRO TO PRINT MULTIPLE EXCEL SHEETS TO ONE Chapter 1 : Print Multiple Sheets Macro to print multiple sheets I have a spreadsheet set up with multiple worksheets. I have one worksheet (Form tab) created that will pull data from the other sheets

More information

PC shortcuts & Mac shortcuts

PC shortcuts & Mac shortcuts PC shortcuts & Mac shortcuts Editing shortcuts Edit active cell F2 U Cut X X Copy C C Paste V V Paste Special Alt E S V Paste name into formula F3 Toggle references F4 T Start a new line within the same

More information

A Back-End Link Checker for Your Access Database

A Back-End Link Checker for Your Access Database A Back-End for Your Access Database Published: 30 September 2018 Author: Martin Green Screenshots: Access 2016, Windows 10 For Access Versions: 2007, 2010, 2013, 2016 Working with Split Databases When

More information

Lab 7 Macros, Modules, Data Access Pages and Internet Summary Macros: How to Create and Run Modules vs. Macros 1. Jumping to Internet

Lab 7 Macros, Modules, Data Access Pages and Internet Summary Macros: How to Create and Run Modules vs. Macros 1. Jumping to Internet Lab 7 Macros, Modules, Data Access Pages and Internet Summary Macros: How to Create and Run Modules vs. Macros 1. Jumping to Internet 1. Macros 1.1 What is a macro? A macro is a set of one or more actions

More information

Excel Vba Manually Update Links Automatically On Open Workbook Don

Excel Vba Manually Update Links Automatically On Open Workbook Don Excel Vba Manually Update Links Automatically On Open Workbook Don I've successfully been able to copy and paste charts from an Excel workbook into vba so I don't have to manually go and change each chart's

More information

Manual Calculation Definition Excel 2010 Vba Set

Manual Calculation Definition Excel 2010 Vba Set Manual Calculation Definition Excel 2010 Vba Set The default is to calculate them automatically, unless certain criteria are met. written for users of the following Microsoft Excel versions: 2007, 2010,

More information

Unit 9: Excel Page( )

Unit 9: Excel Page( ) Unit 9: Excel Page( 496-499) Lab: A. Font B. Fill color C. Font color D. View buttons E. Numeric entry F. Row G. Cell H. Column I. Workbook window J. Active sheet K. Status bar L. Range M. Column labels

More information

Ms Excel Vba Continue Loop Through Worksheets By Name

Ms Excel Vba Continue Loop Through Worksheets By Name Ms Excel Vba Continue Loop Through Worksheets By Name exceltip.com/files-workbook-and-worksheets-in-vba/determine-if- Checks if the Sheet name is matching the Sheet name passed from the main macro. It

More information

Excel Tables and Pivot Tables

Excel Tables and Pivot Tables A) Why use a table in the first place a. Easy to filter and sort if you only sort or filter by one item b. Automatically fills formulas down c. Can easily add a totals row d. Easy formatting with preformatted

More information

Pivot Tables, Lookup Tables and Scenarios

Pivot Tables, Lookup Tables and Scenarios Introduction Format and manipulate data using pivot tables. Using a grading sheet as and example you will be shown how to set up and use lookup tables and scenarios. Contents Introduction Contents Pivot

More information

Microsoft Excel Chapter 2. Formulas, Functions, and Formatting

Microsoft Excel Chapter 2. Formulas, Functions, and Formatting Microsoft Excel 2010 Chapter 2 Formulas, Functions, and Formatting Objectives Enter formulas using the keyboard Enter formulas using Point mode Apply the AVERAGE, MAX, and MIN functions Verify a formula

More information

Workbooks (File) and Worksheet Handling

Workbooks (File) and Worksheet Handling Workbooks (File) and Worksheet Handling Excel Limitation Excel shortcut use and benefits Excel setting and custom list creation Excel Template and File location system Advanced Paste Special Calculation

More information

1.a) Go to it should be accessible in all browsers

1.a) Go to  it should be accessible in all browsers ECO 445: International Trade Professor Jack Rossbach Instructions on doing the Least Traded Product Exercise with Excel Step 1 Download Data from Comtrade [This step is done for you] 1.a) Go to http://comtrade.un.org/db/dqquickquery.aspx

More information

Excel Vba Manually Update Links Automatically On Open File Ignore

Excel Vba Manually Update Links Automatically On Open File Ignore Excel Vba Manually Update Links Automatically On Open File Ignore Powerpoint VBA to update links on excel files open by someone else without alerts So I would have to update manually each link so it will

More information

EXCEL ADVANCED Linda Muchow

EXCEL ADVANCED Linda Muchow EXCEL ADVANCED 2016 Alexandria Technical and Community College Customized Training Technology Specialist 1601 Jefferson Street, Alexandria, MN 56308 320-762-4539 Linda Muchow lindac@alextech.edu 1 Table

More information

Use Do Until to break links

Use Do Until to break links Excel magazines, seminars, add-ons, support and bespoke Excel Systems Edition 0 January 00 IN THIS EDITION Use Do Until to break links Edition 0 Jan 00 >>Files: BreakLinks.xls, AusData.xls, NZData.xls

More information

The American University in Cairo. Academic Computing Services. Excel prepared by. Maha Amer

The American University in Cairo. Academic Computing Services. Excel prepared by. Maha Amer The American University in Cairo Excel 2000 prepared by Maha Amer Spring 2001 Table of Contents: Opening the Excel Program Creating, Opening and Saving Excel Worksheets Sheet Structure Formatting Text

More information

Course Title: Integrating Microsoft Excel with AutoCAD VBA

Course Title: Integrating Microsoft Excel with AutoCAD VBA Las Vegas, Nevada, December 3 6, 2002 Speaker Name: dave espinosa-aguilar Course Title: Integrating Microsoft Excel with AutoCAD VBA Course ID: CP32-2 Course Outline: For years AutoCAD users have been

More information

SAMLab Tip Sheet #4 Creating a Histogram

SAMLab Tip Sheet #4 Creating a Histogram Creating a Histogram Another great feature of Excel is its ability to visually display data. This Tip Sheet demonstrates how to create a histogram and provides a general overview of how to create graphs,

More information