Final Exam Review Part 4 - VBA

Slides:



Advertisements
Similar presentations
Chapter 6, Slide 1Starting Out with Visual Basic 3 rd Edition Chapter 6 Sub Procedures And Functions.
Advertisements

Question Bank. Explain the syntax of if else statement? Define Union Define global and local variables with example Concept of recursion with example.
ISOM3230 Business Applications Programming
P1PMF Split1 QBASIC. P1PMF Split2QBasic Command Prompt Will launch the emulator DOS operating system? Press Alt + Enter to display the widescreen.
C++ Basics March 10th. A C++ program //if necessary include headers //#include void main() { //variable declaration //read values input from user //computation.
Object Oriented Programming A programming concept which views programs as objects with properties and ways to manipulate the object and the properties.
Visual Basic for Applications. What it does Extends the features and built in functions of Excel – Create and run VB procedures – Some may be easy to.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Programming in Visual Basic
Reading and Writing Files Keeping Data. Why do we use files? ä For permanently storing data. ä For dealing with information too large to fit in memory.
VBA Programming Session #2. Things to Review  Variables  Procedures: Subs & Functions  If…Then  For…Next.
C++ Basics CSci 107. A C++ program //include headers; these are modules that include functions that you may use in your //program; we will almost always.
Creating Embedded Formative Assessment Dr. Steve Broskoske Misericordia University EDU 533 Computer-based Education.
Repetition Statements Repeating an Action A specified number of times While a Condition is True Until a Condition is True.
IE 212: Computational Methods for Industrial Engineering
Mr C Johnston ICT Teacher BTEC IT Unit 06 - Lesson 05 Learning To Program.
Chapter 6 Procedures and Functions Instructor: Bindra Shrestha University of Houston – Clear Lake CSCI
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Class 3 Programming in Visual Basic. Class Objectives Learn about input/output Learn about strings Learn about subroutines Learn about arrays Learn about.
PROGRAMMING Functions. Objectives Understand the importance of modular programming. Know the role of functions within programming. Use functions within.
Access VBA Programming for Beginners - Class 2 - by Patrick Lasu
Input Textboxes Input Boxes Different than textboxes Good for small amount of input (form full of textboxes is not nice) X = Inputbox(“prompt message”,
MS Visual Basic Applications Walter Milner. Event-driven programming Standard approach for GUIs Contrast with old character interfaces – program determines.
Introduction to VB.NET 2005 Dr. McDaniel IDS4704 Spring 2005.
IMS 3253: Subroutines 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Procedures Subroutines Parameters –By Value.
Chapter 16: Programming Structures Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
ME 142 Engineering Computation I Exam 2 Review VBA.
22/11/ Selection If selection construct.
5 1 Data Files CGI/Perl Programming By Diane Zak.
Chapter 16: Programming Structures Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Using Text Files in Excel File I/O Methods. Working With Text Files A file can be accessed in any of three ways: –Sequential access: By far the most common.
ME 142 Engineering Computation I Using Subroutines Effectively.
Chapter 3 w Variables, constants, and calculations DIM statements - declaration temporary memory locations identifier, data type, scope data types - values.
Introduction to Excel VBA UNC Charlotte CPE/PDH Series December 17, 2009.
Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the.
Procedures Subs and Functions. Procedures Before OOP, subroutines were the primary high-level way to organize a program. In OOP, this role has been taken.
ME 142 Engineering Computation I Using Subroutines Effectively.
Debugging, Static Variables, ByRef, ByValue Chapt. 6 in Deitel, Deitel and Nieto.
Hungarian Notation A must in this course Every object used MUST be renamed including the form(s) using the following rules Form  frmFormName E.g. frmTemperature.
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
Visual Basic Objects / Properties / Methods PropertyAdjective ObjectNoun Part of the application Attribute MethodVerb Action to do something.
Week Procedures And Functions 7 A procedure is a collection of statements that performs a task.
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
CECS 5020 Computers in Education Visual Basic Variables and Constants.
31/01/ Selection If selection construct.
1 Microsoft® Visual Basic®.NET Language # 2. 2 Flow-Control Statements If … End If Select Case … End Select For… Next Do … Loop Exit.
BACS 287 Programming Fundamentals 5. BACS 287 Programming Fundamentals This lecture introduces the following topics: – Procedures Built-in Functions User-defined.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
Starting Out with Visual Basic.NET 2 nd Edition Chapter 6 Sub Procedures And Functions.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Lecture 7 Methods (functions and subroutines) Parameter Passing
Introduction to Programming Lecture 3 Msury Mahunnah, Department of Informatics, Tallinn University of Technology.
Sub Procedures And Functions
IE 8580 Module 4: DIY Monte Carlo Simulation
Functions CIS 40 – Introduction to Programming in Python
Introduction to VBA for Excel and its utilization in numerical methods
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Matlab review Matlab is a numerical analysis system
IENG 490 LAB FIND/FINDNEXT AND BYREF/BYVAL
VBScript Session 7 Dani Vainstein.
If selection construct
If selection construct
Tonga Institute of Higher Education
Console.WriteLine(“Good luck!”);
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
To understand what arrays are and how to use them
Introduction to Computer Programming IT-104
Tutorial 11 Using and Writing Visual Basic for Applications Code
Programming The ideal style of programming is Structured or
Presentation transcript:

Final Exam Review Part 4 - VBA ChE 160 SI – Becca Fall 2016

Introduction Define/explain the following terms: MsgBox() InputBox() ‘ “ Option Explicit Dim ___ As ___ & ampersand .xlsm

Introduction- Answers MsgBox() output/display from file InputBox() input information into VBA ‘ single apostrophe comment “ double apostrophe string Option Explicit have to dimension/define all variables as their data types Dim ___ As ___ how to dimension variables & ampersand concatenate/piece together strings and variables .xlsm how to save Macro files

&&& Ampersand Practice &&&

Common Errors Missing or misplaced “___” Misspell MsgBox() or InputBox() Forgot to Dim variable As datatype

Loops Write out the basic structure of these loops If loop For loop Do loop

If Loop- Answers If <conditional statement> Then (calculations/commands) ElseIf <another conditional statement> Then (Calculations/commands) Else End If

For Loop- Answers For <counter> = ___ To ___ Step ____ (calculations/commands) Next <counter>

Do Loop- Answers Do (calculations/commands) If <conditional statement> Then Exit Do Loop

Operators Define the conditional operators = <> < > <= >=

Operators- Answers Conditional Operators = equal to <> not equal to < less than > greater than <= less than or equal to >= greater than or equal to

Subroutines and Functions Difference between sub routine and function Difference between ByRef and ByVal Basic structure of a function Basic structure of a subroutine

Subroutines- Answers Difference between sub routine and function Sub does not return anything, function gives a final result. Also, subroutines are called Difference between ByRef and ByVal ByRef = By Reference, takes the reference variable and changes the value everywhere ByVal = By Value, only uses the values locally

Subroutine and Function Structure- Answers Basic structure of a function Function <functionname> (<ByVal or ByRef> <variablename> As <data type>, …….) As <data type> (statements and calculations) <function name> = <expression> NOTE: function has function name as final variable which will be the answer displayed when run. Basic structure of a subroutine Sub <subroutinename> (<ByVal or ByRef> <variablename> As <variabletype>, ….) (statements with variables in argument list and declared in subprogram) End sub

Inputs and Outputs Output vs Append vs Input Print vs Write vs Input

Inputs and Outputs- Answers Append Input Open (pathname\filename) For Output As #filenumber Open (pathname\filename) For Append As #filenumber Open (pathanme\filename) For Input As #filenumber VBA will create the file if one doesn't exist Has to exist before opening Write over everything in the file Adds onto a file Brings information into VBA Ends with Close #filenumber

Inputs and Outputs- Answers Print Write Input Print #filenumber, [outputlist] Write #filenumber, [outputlist, comma delimited] Input #filenumber, variablelist Variables can be separated using semicolons or commas Values have to be separated by commas Values have to be designated as correct data type to be inputted ( "" around strings, everything separated by commas) Comma separates by tabs Write file has commas still in between data types Semicolon separates by spaces

Arrays How do you create an array using VBA?

Arrays- Answers For Count = 1 To 11 Column(Count, 1) = 2 * Count - 1 Next Count

How did that go?