EXCEL WORKSHOP III INTRODUCTION TO MACROS AND VBA PROGRAMMING

Size: px
Start display at page:

Download "EXCEL WORKSHOP III INTRODUCTION TO MACROS AND VBA PROGRAMMING"

Transcription

1 EXCEL WORKSHOP III INTRODUCTION TO MACROS AND VBA PROGRAMMING

2 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 VBA 1. Hierarchy 2. Properties & Methods 3. Variables 5. Macro Recorder

3 TABLE OF CONTENTS 6. Hello World 1. MsgBox 2. OnLoad 7. Buttons 8. Reactions 9. Arrays 10. Example: AddOneYear() to a development triangle 1. Loops / Conditional Statements 2. Custom functions

4 WHAT IS VBA? VBA stands for Visual Basic for Applications Closely related to Microsoft s Visual Basic VB is very archaic and now retired VBA an Object-based Language Similar to object-oriented languages (C++, Java) You ll see variables, for-loops, functions, etc. Excel workbooks that contain macros are.xlsm files Normal workbooks are.xlsx We use VBA to make repetitive or complex jobs easier

5 SAFETY FIRST! By default, macros are disabled with notification Potentially malicious code can run For example, endless MsgBoxes You need to enable macros when opening a.xlsm workbook Only enable macros from sources you trust Access Macro Settings: File > Options > Trust Center > Trust Center Settings > Macro Settings

6 GETTING STARTED Enable the Developer tab Right click on the ribbon > Customize ribbon > Check-mark the developer tab Open the VBA Editor Click Developer tab > Visual Basic Or use Alt+F11 The Editor is where you edit VBA modules Modules consists of Sub procedures and Function procedure

7 BASIC VBA: HIERARCHY VBA is object-based Objects include Workbooks, Worksheets, Cells, and Variables Objects are organized into a hierarchy: Application.Workbooks("Book1.xlsx") Application.Workbooks("Book1.xlsx").Worksheets("Sheet1") Application.Workbooks("Book1.xlsx").Worksheets("Sheet1").Range( A1 ) Excel uses the active objects if you omit references Range( A1 ) refers to Cell A1 on the active worksheet in the active workbook You can also access cells using column and row number Cell A2 is Cells(1,2) or Range( A2 )

8 BASIC VBA: PROPERTIES & METHODS Objects have properties Range("A1").Value 'Returns the content of Cell A1 Range("A1").Width 'Returns the width of the Cell A1 Range("A1").Font Objects have methods Range("A1").ClearContents Workbook("Book1.xlsx").Close Range("A2:A3").Copy _ 'Underscore indicates continuation to next line destination:= Range("B2") 'destination is a parameter of the Copy method

9 BASIC VBA: VARIABLES Declaring a variable using the keywords Dim and as Dim myint as Integer 'Allocates 2 bytes of memory for an Integer myint = 100 'Sets the value of the variable Other commonly used data types include Double (8 bytes) Used for floating-point numbers (decimals) Fixed-length String (Size depends on number of characters) Used for text Dim mystring As String * stringlength Variable-length String (10 more bytes than a Fixed-length String) Dim mystring As String Boolean (2 bytes ) True (-1) or False (0) Variant (16 bytes) Can store any kind of data. Slower to process and makes code hard to read.

10 THE IMMEDIATE WINDOW Very useful feature in the VBA Editor Open with Ctrl+G or View > Immediate Window You can ask questions in the Immediate Window?Worksheets.Count?Range("B2").Value Debug.Print is useful when you are debugging Public Sub PrintValue() Debug.Print "Hello" 'Prints to the immediate window Debug.Print x 'Prints the value of the variable x End Sub

11 RECORDING MACROS A lot of people learn to code in VBA by recording actions in Excel and reading the code for those actions. Step 1: Start recording Developer > Code > Record Macro Step 2: Do stuff in your workbook Step 3: Stop recording Developer > Code > Stop Recording Step 4: Read the code in the Editor Developer > Code > Visual Basic (or Alt+F11)

12 RECORDING MACROS: EXAMPLE You have data on ALL Major League Baseball teams performance from the past decades We ask: How has the win-percentage of 1 st -place teams in the NL West Division changed over the years? Generate a linear regression line. 1. Go to the sheet Using Macro Recorder 2. Start recording: Developer > Code > Record Macro 3. Activate filtering: Data > Sort & Filter > Filter 4. Filter Column D for NL West 5. Filter Column K for 1 st Place Finishes 6. Select Columns B (Year) and I (Win Percentage) 7. Insert > Scatterplot 8. Right-click the plus-sign (+) for Chart Elements, then add Trendline 9. Go to More Options for the Trendline and Display Equation and R² 10. Stop recording

13 RECORDING MACROS: EXAMPLE Go to Developer > Visual Basic to review the code in the Editor Sub Macro1() Selection.AutoFilter 'Activates Filtering ActiveSheet.Range("$A$1:$V$2565").AutoFilter _ Field:=4, _ 'Filters the 4 th column of Selection Criteria1:="NL West" 'For those in the NL West ActiveSheet.Range("$A$1:$V$2565").AutoFilter _ Field:=11, _ Criteria1:=Array( "1st of 4",, "1st of 7"), _ Operator:=xlFilterValues

14 RECORDING MACROS: EXAMPLE Range("B:B,I:I").Select ActiveSheet.Shapes.AddChart2(240, xlxyscatter).select ActiveChart.FullSeriesCollection(1).Trendlines.Add Type:=xlLinear,, DisplayEquation:=0, DisplayRSquared:=0, Name:="Linear (W.L.)" ActiveChart.FullSeriesCollection(1).Trendlines.Add ActiveChart.FullSeriesCollection(1).Trendlines(2).Select Selection.DisplayEquation = True 'Displays equation y=mx+b Selection.DisplayRSquared = True 'Displays R-squared value Application.CommandBars("Format Object").Visible = False 'Closes sidebar End Sub

15 HELLO, WORLD Let s try a few different ways to display Hello World Create a new module in the Project Window Edit the name of the module in the Properties Window (F4) Write the following code: Option Explicit 'You must explicitly Dim new variables As a data type Sub HelloWorld() 'Sets the content of Cell C5 to Hello World ActiveSheet.Range("C5").Value = "Hello World" End Sub In Excel, go to Developer > Code > Macros and click HelloWorld to run

16 HELLO WORLD: MESSAGE BOXES Create another module in the Project Window Write the following code: Option Explicit Sub HelloWorldPopUp() MsgBox "Hello World 'Generates a pop-up box End Sub In Excel, run this HelloWorldPopUp macro

17 HELLO WORLD: ONLOAD Create another module in the Project Window Write the following code: Private Sub Worksheet_Activate() MsgBox ("Thank you for coming to the workshop today!") End Sub Private Sub Worksheet_Deactivate() MsgBox ("Bye, I will miss you") End Sub In Excel, click this sheet, and then click away to see the MsgBoxes

18 BUTTONS You can create a button to run a macro when you click on it Step 1. Draw a button. Go to Developer > Controls > Insert > Button (Form Control) Draw the button Step 2. Assign a macro. Right-click on the button > Assign Macro > New/Edit Type the following code: Option Explicit Sub HelloWorld() ActiveSheet.Range("C5").Value = "Hello World" End Sub

19 REACTIONS You can write a macro to react to a user s action Option Explicit Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Selection.Count = 1 Then If Not Intersect(Target, Range("F8")) Is Nothing Then MsgBox "Hello there" ElseIf Not Intersect(Target, Range("F10")) Is Nothing Then MsgBox "Oopsie, wrong button" End If End If End Sub

20 ARRAYS An array holds a list of elements of the same data type There are multiple ways to declare a static array. Dim myarray(0 To 3) As Integer 'Create array with locations 0,1,2,3 Dim myarray(3) As Integer 'Defaults as 0 to 3 i.e. locations 0,1,2,3 Dim myarray(1 To 5) As Integer 'Locations 1,2,3,4,5 You can set the values of elements myarray(3) = 97 'Sets the value of the 4 th element of myarray to be 97

21 ARRAYS CONTD. You can use the Array function to set the values in an array of Variants Dim arr1 As Variant arr1 = Array("Orange", "Peach", "Pear") Dynamic Arrays do not need the size to be specified upon declaration Dim dynarr1() As Variant 'Declares a dynamic array ReDim dynarr(x+1) 'Sets the size of the array to x+1 ReDim Preserve dynarr(x+3) 'Extends the size of the array by 2 while preserving existing data

22 DEVELOPMENT TRIANGLE The development triangle is used to project ultimate losses The triangle below shows losses for six accident periods (2012,, 2017) The loss amount for each accident period is shown at various ages (months after the beginning of the accident period) A B C D E F G

23 DEVELOPMENT TRIANGLE The triangle below is As of 12/31/2017. At 12/31/2018, we need to add a row (Acc. Per. 2018) and a column (age 96) Let s write a macro called AddOneYear() A B C D E F G

24 EXAMPLE: ADDING A YEAR TO A DEVELOPMENT TRIANGLE Option Explicit Sub AddOneYear() Application Range("B1").Select 'Begin in Cell B1 (Age 12) Dim lastage As Integer 'Will store the rightmost age (Age 84) 'Loop rightward across ages until the rightmost (Age 84) is found While IsEmpty(ActiveCell) = False lastage = ActiveCell.Value 'Store value as lastage found 'Select one cell to the right ActiveCell.Offset(0, 1).Select Wend ActiveCell.Value = lastage + 12 'Adds Age 96 to the right

25 EXAMPLE: ADDING A YEAR TO A DEVELOPMENT TRIANGLE Range("A2").Select Dim lastyear As Integer While IsEmpty(ActiveCell) = False lastyear = ActiveCell.Value ActiveCell.Offset(1, 0).Select Wend ActiveCell.Value = lastyear + 1 Range("A1").Select 'Return to Cell A1 End Sub

26 QUESTIONS?

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

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

Sébastien Mathier wwwexcel-pratiquecom/en Variables : Variables make it possible to store all sorts of information Here's the first example : 'Display the value of the variable in a dialog box 'Declaring

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

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

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

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

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

Objects and Basic Programming Concepts (See Chapters 5 (skip ED 3), 6 of Albright) (See Chapters 5 (skip ED 4), 6 of Albright)

Objects and Basic Programming Concepts (See Chapters 5 (skip ED 3), 6 of Albright) (See Chapters 5 (skip ED 4), 6 of Albright) Objects and Basic Programming Concepts (See Chapters 5 (skip 71-78 ED 3), 6 of Albright) (See Chapters 5 (skip 78-84 ED 4), 6 of Albright) Kipp Martin January 12, 2012 Excel Files Files used in this lecture:

More information

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

6/14/2010. VBA program units: Subroutines and Functions. Functions: Examples: Examples: 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

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

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

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

Vba Variables Constant and Data types in Excel

Vba Variables Constant and Data types in Excel Vba Variables Constant and Data types in Excel VARIABLES In Excel VBA, variables are areas allocated by the computer memory to hold data. Data stored inside the computer memory has 4 properties: names,

More information

Microsoft Excel Basics Ben Johnson

Microsoft Excel Basics Ben Johnson Microsoft Excel Basics Ben Johnson Topic...page # Basics...1 Workbook and worksheets...1 Sizing columns and rows...2 Auto Fill...2 Sort...2 Formatting Cells...3 Formulas...3 Percentage Button...4 Sum function...4

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

Advanced Excel Macros : Data Validation/Analysis : OneDrive

Advanced Excel Macros : Data Validation/Analysis : OneDrive Advanced Excel Macros : Data Validation/Analysis : OneDrive Macros Macros in Excel are in short, a recording of keystrokes. Beyond simple recording, you can use macros to automate tasks that you will use

More information

Jump Right In! Essential Computer Skills Using Microsoft 2013 By Andrews, Dark, and West

Jump Right In! Essential Computer Skills Using Microsoft 2013 By Andrews, Dark, and West Jump Right In! Essential Computer Skills Using Microsoft 2013 By Andrews, Dark, and West Chapter 10 Managing Numbers and Text Using Excel 1 Objectives Examine the Excel window and tools Enter and format

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

Sébastien Mathier www.excel-pratique.com/en Conditions : Conditions are very useful in programming because they allow us to execute actions based on specific criteria (it's the same principle as the IF

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

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

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

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

d2vbaref.doc Page 1 of 22 05/11/02 14:21

d2vbaref.doc Page 1 of 22 05/11/02 14:21 Database Design 2 1. VBA or Macros?... 2 1.1 Advantages of VBA:... 2 1.2 When to use macros... 3 1.3 From here...... 3 2. A simple event procedure... 4 2.1 The code explained... 4 2.2 How does the error

More information

Appendix A1 Visual Basics for Applications (VBA)

Appendix A1 Visual Basics for Applications (VBA) Credit Risk Modeling Using Excel and VBA with DVD By Gunter Löffler and Peter N. Posch 2011 John Wiley & Sons, Ltd. Appendix A1 Visual Basics for Applications (VBA) MACROS AND FUNCTIONS In this book, we

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

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

Variables in VB. Keeping Track

Variables in VB. Keeping Track Variables in VB Keeping Track Variables Variables are named places in the computer memory that hold information. Variables hold only a single value at a time. Assigning a new value to them causes the old

More information

Learning Excel VBA. Using Loops in Your Code. ComboProjects. Prepared By Daniel Lamarche

Learning Excel VBA. Using Loops in Your Code. ComboProjects. Prepared By Daniel Lamarche Learning Excel VBA Using s in Your Code Prepared By Daniel Lamarche ComboProjects Using s in Your Code By Daniel Lamarche (Last update June 2016). s are pretty simple in concept however many new programmers

More information

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Program: Microsoft Access Series DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) AGENDA 3. Executing VBA

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

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

CS130/230 Lecture 12 Advanced Forms and Visual Basic for Applications

CS130/230 Lecture 12 Advanced Forms and Visual Basic for Applications CS130/230 Lecture 12 Advanced Forms and Visual Basic for Applications Friday, January 23, 2004 We are going to continue using the vending machine example to illustrate some more of Access properties. Advanced

More information

3. (1.0 point) To quickly switch to the Visual Basic Editor, press on your keyboard. a. Esc + F1 b. Ctrl + F7 c. Alt + F11 d.

3. (1.0 point) To quickly switch to the Visual Basic Editor, press on your keyboard. a. Esc + F1 b. Ctrl + F7 c. Alt + F11 d. Excel Tutorial 12 1. (1.0 point) Excel macros are written in the programming language. a. Perl b. JavaScript c. HTML d. VBA 2. (1.0 point) To edit a VBA macro, you need to use the Visual Basic. a. Manager

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

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

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 2007 TIP SHEET. Dialog Box Launcher these allow you to access additional features associated with a specific Group of buttons within a Ribbon.

EXCEL 2007 TIP SHEET. Dialog Box Launcher these allow you to access additional features associated with a specific Group of buttons within a Ribbon. EXCEL 2007 TIP SHEET GLOSSARY AutoSum a function in Excel that adds the contents of a specified range of Cells; the AutoSum button appears on the Home ribbon as a. Dialog Box Launcher these allow you to

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

Creating If/Then/Else Routines

Creating If/Then/Else Routines 10 ch10.indd 147 Creating If/Then/Else Routines You can use If/Then/Else routines to give logic to your macros. The process of the macro proceeds in different directions depending on the results of an

More information

Learning Excel VBA. About Variables. ComboProjects. Prepared By Daniel Lamarche

Learning Excel VBA. About Variables. ComboProjects. Prepared By Daniel Lamarche Learning Excel VBA About Variables Prepared By Daniel Lamarche ComboProjects About Variables By Daniel Lamarche (Last update February 2017). The term variables often send shivers in the back of many learning

More information

Excel s VBA for Complete Beginners

Excel s VBA for Complete Beginners MAME and CEUS present, Excel s VBA for Complete Beginners Presented by Charles Cossette Authored by Ken Carney Extended and Modified (a lot) by Charles C. Cossette Table of Contents 1 Introduction What

More information

OpenOffice.org 3.2 BASIC Guide

OpenOffice.org 3.2 BASIC Guide OpenOffice.org 3.2 BASIC Guide Copyright The contents of this document are subject to the Public Documentation License. You may only use this document if you comply with the terms of the license. See:

More information

Microsoft Excel Microsoft Excel

Microsoft Excel Microsoft Excel Excel 101 Microsoft Excel is a spreadsheet program that can be used to organize data, perform calculations, and create charts and graphs. Spreadsheets or graphs created with Microsoft Excel can be imported

More information

Ms Excel Vba Continue Loop Through Columns Range

Ms Excel Vba Continue Loop Through Columns Range Ms Excel Vba Continue Loop Through Columns Range Learn how to make your VBA code dynamic by coding in a way that allows your 5 Different Ways to Find The Last Row or Last Column Using VBA In Microsoft

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

A guide to writing Excel formulas and VBA macros. Mark McIlroy

A guide to writing Excel formulas and VBA macros. Mark McIlroy A guide to writing Excel formulas and VBA macros Mark McIlroy Other books by the author The Wise Investor Introduction to the Stockmarket SQL Essentials Introduction to Computer Science Starting a Small

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

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

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

Sébastien Mathier www.excel-pratique.com/en Selections : We'll begin by creating a macro that selects the cell that we specifiy. First open the editor and add a module : In the module, type "sub selection"

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

An overview about DroidBasic For Android

An overview about DroidBasic For Android An overview about DroidBasic For Android from February 25, 2013 Contents An overview about DroidBasic For Android...1 Object-Oriented...2 Event-Driven...2 DroidBasic Framework...2 The Integrated Development

More information

Advance Excel Performing calculations on data 1. Naming groups of data 2. Creating formulas to calculate values

Advance Excel Performing calculations on data 1. Naming groups of data 2. Creating formulas to calculate values Advance Excel 2013 Getting started with Excel 2013 1. Identifying the different Excel 2013 programs 2. Identifying new features of Excel 2013 a. If you are upgrading from Excel 2010 b. If you are upgrading

More information

<excelunusual.com> Creating, Sizing, Translating and Rotating 2D Shapes in Excel by George Lungu. < 1

<excelunusual.com> Creating, Sizing, Translating and Rotating 2D Shapes in Excel by George Lungu. <  1 Creating, Sizing, Translating and Rotating 2D Shapes in Excel 2007 - by George Lungu Most of the models on this blog are designed for Excel 2003 or earlier versions. Sometimes however Excel 2007 or 200

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

Language Fundamentals

Language Fundamentals Language Fundamentals VBA Concepts Sept. 2013 CEE 3804 Faculty Language Fundamentals 1. Statements 2. Data Types 3. Variables and Constants 4. Functions 5. Subroutines Data Types 1. Numeric Integer Long

More information

Abdulbasit H. Mhdi Assistant lecturer Chemical engineering/ Tikrit University

Abdulbasit H. Mhdi Assistant lecturer Chemical engineering/ Tikrit University Abdulbasit H. Mhdi Assistant lecturer Chemical engineering/ Tikrit University Introduction To Microsoft Excel Getting started with Excel Excel and Word have a lot in common, since it s belong to the MS

More information

ADVANCED EXCEL Course Modules for Advance Excel Training Online (MS Excel 2013 Course):

ADVANCED EXCEL Course Modules for Advance Excel Training Online (MS Excel 2013 Course): Course Modules for Advance Excel Training Online (MS Excel 2013 Course): ADVANCED EXCEL 2013 1 Getting started with Excel 2013 A Identifying the different Excel 2013 programs B Identifying new features

More information

Microsoft Excel 2016 Level 1

Microsoft Excel 2016 Level 1 Microsoft Excel 2016 Level 1 One Day Course Course Description You have basic computer skills such as using a mouse, navigating through windows, and surfing the Internet. You have also used paper-based

More information

CSE 123 Introduction to Computing

CSE 123 Introduction to Computing CSE 123 Introduction to Computing Lecture 11 Programming with Arrays SPRING 2012 Assist. Prof. A. Evren Tugtas Array Variables Review For detailed information on array variables look at the notes of Lecture

More information

Control Statements Selection (Conditional Logic)

Control Statements Selection (Conditional Logic) Control Statements Selection (Conditional Logic) INTRODUCTION In the last few weeks, you were introduced to the concept of flow of control: the sequence of statements that the computer executes. In procedurally

More information

Visual Basic for Applications

Visual Basic for Applications Visual Basic for Applications Programming Damiano SOMENZI School of Economics and Management Advanced Computer Skills damiano.somenzi@unibz.it Week 1 Outline 1 Visual Basic for Applications Programming

More information

Microsoft Excel 2010 Training. Excel 2010 Basics

Microsoft Excel 2010 Training. Excel 2010 Basics Microsoft Excel 2010 Training Excel 2010 Basics Overview Excel is a spreadsheet, a grid made from columns and rows. It is a software program that can make number manipulation easy and somewhat painless.

More information

most of that the data into change the paste Rename the sheet this:

most of that the data into change the paste Rename the sheet this: Tutorial 2: A more advanced and useful macro Now that you are somewhat familiar with the programing environment of VBA, this will introduce you, quickly, to some of the more useful commands you can do

More information

Overview About KBasic

Overview About KBasic Overview About KBasic The following chapter has been used from Wikipedia entry about BASIC and is licensed under the GNU Free Documentation License. Table of Contents Object-Oriented...2 Event-Driven...2

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

Visual basic tutorial problems, developed by Dr. Clement,

Visual basic tutorial problems, developed by Dr. Clement, EXCEL Visual Basic Tutorial Problems (Version January 20, 2009) Dr. Prabhakar Clement Arthur H. Feagin Distinguished Chair Professor Department of Civil Engineering, Auburn University Home page: http://www.eng.auburn.edu/users/clemept/

More information

Good Variable Names: dimensionone, dimension1 Bad Variable Names: dimension One, 1dimension

Good Variable Names: dimensionone, dimension1 Bad Variable Names: dimension One, 1dimension VB Scripting for CATIA V5: Email Course by Emmett Ross Lesson #4 - CATIA Macro Variable Naming Variables make up the backbone of any programming language. Basically, variables store information that can

More information

Using Numbers, Formulas, and Functions

Using Numbers, Formulas, and Functions UNIT FOUR: Using Numbers, Formulas, and Functions T o p i c s : Using the Sort function Create a one-input data table Hide columns Resize columns Calculate with formulas Explore functions I. Using the

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

Reference Services Division Presents. Excel Introductory Course

Reference Services Division Presents. Excel Introductory Course Reference Services Division Presents Excel 2007 Introductory Course OBJECTIVES: Navigate Comfortably in the Excel Environment Create a basic spreadsheet Learn how to format the cells and text Apply a simple

More information

The Microsoft Excel Course is divided into 4 levels

The Microsoft Excel Course is divided into 4 levels MS Excel is a very powerful tools used by most of the data analyst in the industry. In this course you will learn how to Master Excel and make it perform any kind of data analysis and Visualization. You

More information

Microsoft Excel 2010 Level 1

Microsoft Excel 2010 Level 1 Microsoft Excel 2010 Level 1 One Day Course Course Description You have basic computer skills such as using a mouse, navigating through windows, and surfing the Internet. You have also used paper-based

More information

Inserting or deleting a worksheet

Inserting or deleting a worksheet Inserting or deleting a worksheet To insert a new worksheet at the end of the existing worksheets, just click the Insert Worksheet tab at the bottom of the screen. To insert a new worksheet before an existing

More information

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals VARIABLES WHAT IS A VARIABLE? A variable is a storage location in the computer s memory, used for holding information while the program is running. The information that is stored in a variable may change,

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

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

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

How to Use Do While Loop in Excel VBA

How to Use Do While Loop in Excel VBA We have already covered an introduction to looping and the simplest type of loops, namely the For Next Loop and the For Each Next Loop, in previous tutorials. We discovered that the For Next Loop and the

More information

Making Excel Work for Your Tribal Community

Making Excel Work for Your Tribal Community Making Excel Work for Your Tribal Community Excel Basics: Intermediate Skills PHONE: 1-800-871-8702 EMAIL: INFO@CBC4TRIBES.ORG WEB: TRIBALINFORMATIONEXCHANGE.ORG MAKING EXCEL WORK FOR YOUR TRIBAL COMMUNITY

More information

Advanced Excel. Microsoft Excel Instructor: Don Bremer. Presented and co-sponsored by:

Advanced Excel. Microsoft Excel Instructor: Don Bremer. Presented and co-sponsored by: Advanced Excel Microsoft Excel 2010 Instructor: Don Bremer Presented and co-sponsored by: 11 East Superior Street, Suite 210 Duluth, MN 55802 218-726-7298 (main) 888-387-4594 (toll free) www.umdced.com

More information

Chapter 13. Creating Business Diagrams with SmartArt. Creating SmartArt Diagrams

Chapter 13. Creating Business Diagrams with SmartArt. Creating SmartArt Diagrams Chapter 13 Creating Business Diagrams with SmartArt Office 2007 adds support for 80 different types of business diagrams. These diagrams include list charts, process charts, cycle charts, hierarchy and

More information

Do Until Loop in Excel VBA with Examples

Do Until Loop in Excel VBA with Examples The Do Until Loop Structure is utilized, when one has a set of statements or actions to be repeated and repetition occurs until the condition evaluates to true, in other words, while the condition is false

More information

Scientific Graphing in Excel 2013

Scientific Graphing in Excel 2013 Scientific Graphing in Excel 2013 When you start Excel, you will see the screen below. Various parts of the display are labelled in red, with arrows, to define the terms used in the remainder of this overview.

More information

How to Create a For Next Loop in Excel VBA!

How to Create a For Next Loop in Excel VBA! Often when writing VBA code, one may need to repeat the same action or series of actions more than a couple of times. One could, in this case, write each action over and over in one s code or alternatively

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

<excelunusual.com> Easy Zoom -Chart axis Scaling Using VBA - by George Lungu. <www.excelunusual.com> 1. Introduction: Chart naming: by George Lungu

<excelunusual.com> Easy Zoom -Chart axis Scaling Using VBA - by George Lungu. <www.excelunusual.com> 1. Introduction: Chart naming: by George Lungu Easy Zoom -Chart axis Scaling Using VBA - by George Lungu Introduction: - In certain models we need to be able to change the scale of the chart axes function of the result of a simulation - An Excel chart

More information

Power Query for Parsing Data

Power Query for Parsing Data Excel Power Query Power Query for Parsing Data Data Models Screen 1In Excel 2010 and 2013 need to install the Power Query; however, in 2016 is automatically part of the Data Tab ribbon and the commands

More information

Microsoft Office Excel 2007: Basic Course 01 - Getting Started

Microsoft Office Excel 2007: Basic Course 01 - Getting Started Microsoft Office Excel 2007: Basic Course 01 - Getting Started Slide 1 Getting started Course objectives Identify spreadsheet components Identify the main components of Excel Use the Help feature Open

More information

Microsoft Visual Basic 2015: Reloaded

Microsoft Visual Basic 2015: Reloaded Microsoft Visual Basic 2015: Reloaded Sixth Edition Chapter Three Memory Locations and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named constants

More information

Public Function randomdouble(lowerbound As Double, upperbound As Double) As Double On Error Resume Next

Public Function randomdouble(lowerbound As Double, upperbound As Double) As Double On Error Resume Next Table of Contents Introduction...1 Using VBA Functions...1 Accessing Visual Basic in Excel...2 Some Example Functions...3 Random Numbers...4 RandomDouble...4 randomint...4 Using the random numbers...5

More information

x, with a range of 1-50 (You can use the randbetween command on excel)

x, with a range of 1-50 (You can use the randbetween command on excel) HW 2, Part 1 Question 1 (In EXCEL) Create a data set with the following characteristics: Sample size: 100 One independent variable: x, with a range of 1-50 (You can use the randbetween command on excel)

More information

Full file at Excel Chapter 2 - Formulas, Functions, Formatting, and Web Queries

Full file at   Excel Chapter 2 - Formulas, Functions, Formatting, and Web Queries Excel Chapter 2 - Formulas, Functions, Formatting, and Web Queries MULTIPLE CHOICE 1. To start a new line in a cell, press after each line, except for the last line, which is completed by clicking the

More information

Lastly, in case you don t already know this, and don t have Excel on your computers, you can get it for free through IT s website under software.

Lastly, in case you don t already know this, and don t have Excel on your computers, you can get it for free through IT s website under software. Welcome to Basic Excel, presented by STEM Gateway as part of the Essential Academic Skills Enhancement, or EASE, workshop series. Before we begin, I want to make sure we are clear that this is by no means

More information

Class #10 Wednesday, November 8, 2017

Class #10 Wednesday, November 8, 2017 Graphics In Excel Before we create a simulation, we need to be able to make a drawing in Excel. The techniques we use here are also used in Mathematica and LabVIEW. Drawings in Excel take place inside

More information

How to convert a numeric value into English words in Excel

How to convert a numeric value into English words in Excel How to convert a numeric value into English words in Excel (Microsoft Office Excel 2003, Microsoft Office Excel 2007, Microsoft Excel 2010, Excel 2016, Microsoft Excel 2013) Summary This article contains

More information

Review for Programming Exam and Final May 4-9, Ribbon with icons for commands Quick access toolbar (more at lecture end)

Review for Programming Exam and Final May 4-9, Ribbon with icons for commands Quick access toolbar (more at lecture end) Review for Programming Exam and Final Larry Caretto Mechanical Engineering 209 Computer Programming for Mechanical Engineers May 4-9, 2017 Outline Schedule Excel Basics VBA Editor and programming variables

More information

Microsoft Excel 2007 Creating a XY Scatter Chart

Microsoft Excel 2007 Creating a XY Scatter Chart Microsoft Excel 2007 Creating a XY Scatter Chart Introduction This document will walk you through the process of creating a XY Scatter Chart using Microsoft Excel 2007 and using the available Excel features

More information