IE 8580 Module 4: DIY Monte Carlo Simulation

Slides:



Advertisements
Similar presentations
Macros/VBA Project Modules and Creating Add-Ins on the Toolbar
Advertisements

Excel and Visual Basic. Outline Data exchange between Excel and Visual Basic. Programming VB in Excel.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Excel Project 7 Using Macros and Visual Basic for Applications (VBA) with Excel.
Web ADI - Srinivas.M. Purpose Data upload into Oracle Applications Solution: Web ADI brings Oracle E-Business Suite functionality to a spreadsheet, where.
Using Macros and Visual Basic for Applications (VBA) with Excel
Tutorial 7: Developing an Excel Application
Developing an Excel Application
Tutorial 8: Developing an Excel Application
XP New Perspectives on Microsoft Excel 2003, Second Edition- Tutorial 8 1 Microsoft Office Excel 2003 Tutorial 8 – Developing an Excel Application.
With Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2010.
Macros Excel built-in functions are great but limited Macros are a means for the user to define new functions A macro is a single command that automates.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro.
Excel Lesson 14 Creating and Using Macros Microsoft Office 2010 Advanced Cable / Morrison 1.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Macros and VBA A macro is a set of instructions that tells Excel which commands to execute.
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
Microsoft Office Word 2013 Core Microsoft Office Word 2013 Core Courseware # 3250 Lesson 8: Using Productivity Tools.
University of Delaware Information Technology User Services.
Introduction to VBA. This is not Introduction to Excel We’re going to assume you have a basic level of familiarity with Excel If you don’t, or you need.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #2: The Visual Basic Editor The Visual Basic for Applications Programming Language IE 212: Computational.
Project 9 Using Visual Basic for Applications (VBA) to Customize and Automate Excel Jason C. H. Chen, Ph.D. Professor of Management Information Systems.
1 CS 106 Computing Fundamentals II Chapter 17 “Introduction To VBA” Herbert G. Mayer, PSU CS status 6/30/2013 Initial content copied verbatim from CS 106.
Microsoft Excel 2007 © Wiley Publishing All Rights Reserved. The L Line The Express Line to Learning L Line.
Adapting a ready made PowerPoint quiz with VBA
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 22 Macros.
Copyright 2007, Paradigm Publishing Inc. EXCEL 2007 Chapter 7 BACKNEXTEND 7-1 LINKS TO OBJECTIVES Record & run a macro Record & run a macro Save as a macro-
Microsoft Excel Macros & Excel Solver (IENG490)
Introduction to VBA MGMI Aug What is VBA? VBA = Visual Basic for Application Excel’s powerful built-in programming language An event-driven.
1 Visual Basic for Applications (VBA) for Excel Prof. Yitzchak Rosenthal.
Chapter 11: Introduction to the Visual Basic Environment Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Lecture Excel: Macros & Pivot Tables. Macros A macro is a series of commands that are stored and can be run whenever you need to perform the task.
Visual Basic for Applications Macro Programming For Microsoft Office.
© Wiley Publishing All Rights Reserved. Automating Tasks with Macros Book VIII, Chapter 7…
Visual Basic  Is the language for programming in Word, Access,& Excel  Is the “Environment” in which the programming is done (called the Integrated Development.
Chapter 11: Introduction to VBA Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Introduction to Excel VBA UNC Charlotte CPE/PDH Series December 17, 2009.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft® Excel 2013.
Introduction to Microsoft Excel Macros COE 201- Computer Proficiency.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft® Excel 2013.
1 CA202 Spreadsheet Application Automating Repetitive Tasks with Macros Lecture # 12 Dammam Community College.
Macros in Excel Using VBA Time Required – 5 hours.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Using Macros Lesson.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Before Starting Course Ensure Developer ribbon is visible in Microsoft Excel (see following slides) Check security settings (see following slides) You.
DoD EA Dip Cse - NCW Export Macros
Excel Tutorial 8 Developing an Excel Application
IE 8580 Module 4: DIY Monte Carlo Simulation
Exploring Excel Chapter 7 Automating Repetitive Tasks: Macros and
Creating a Windchill Report Interface in Excel
Outline In this module, the following topics will be covered:
Excel: Macros & Pivot Tables
Computer Fundamentals
TDA Direct Certification
Microsoft Excel 2003 Illustrated Complete
Introducing VBA Macros
Introduction to VBA IE 469 Spring 2018.
Exploring Microsoft® Excel® 2016 Series Editor Mary Anne Poatsy
Exploring Microsoft Excel
أ.إسراء الطريقي أ. هاله الشملان , 102 تقن , المعمل الخامس
ME 142 Engineering Computation I
Lesson 1 - Automating Tasks
Images into PowerPoint
Microsoft Office Excel 2003
Excel as your personal factotum
Creating a Windchill Report Interface in Excel
Microsoft Excel 2007 – Level 2
Visual Basic for Applications: Introduction
Presentation transcript:

IE 8580 Module 4: DIY Monte Carlo Simulation Lecture 4.1: Visual Basic for Applications 101

Scott J. Mason, Ph.D., mason@clemson.edu Visual Basic Editor The Visual Basic Editor (VBE) is the environment in which you work with VBA programming code. ALT + F11 VB Developer Tab Add it through the Excel Options Click Visual Basic Scott J. Mason, Ph.D., mason@clemson.edu

Scott J. Mason, Ph.D., mason@clemson.edu Visual Basic Editor Code is saved in a .xlsm file Clicking Save in VB Editor or Excel saves both the Excel file and the VB code To see a missing window: View: select the window Code Window, Project Window, Properties Window Code window: where the code goes Scott J. Mason, Ph.D., mason@clemson.edu

Scott J. Mason, Ph.D., mason@clemson.edu Fix Security Settings On the Developer Tab, click Macro Security Click Disable all macros with notification Scott J. Mason, Ph.D., mason@clemson.edu

When opening a .xlsm file When you see the message below, Enable Content, assuming you know/trust the source of the file! IE 8580, mason@clemson.edu

Scott J. Mason, Ph.D., mason@clemson.edu Record Your Own Macro Developer Tab Click Record Macro This is how I “learned” to write code when I was kid You can assign a hot key to run this macro (e.g., j) Scott J. Mason, Ph.D., mason@clemson.edu

Relative/Absolute References Relative References On Relative References Off Absolute References Scott J. Mason, Ph.D., mason@clemson.edu

Example: Relative References Off Record Macro with relative references off Create a spreadsheet with the text entries as follows, then click Record Macro Insert two rows below “Monday” Move “Robert” cell below “Monday” Move “Register” cell below “Robert” Select the cell directly below Click Stop Recording Scott J. Mason, Ph.D., mason@clemson.edu

Example: Relative References Off When the macro runs, two rows are inserted below “Monday” again instead of below “Tuesday” The rows are always inserted between rows 1 and 2 and cells B1 and C1 are always moved Scott J. Mason, Ph.D., mason@clemson.edu

Example: Relative References Off The VBA code: Scott J. Mason, Ph.D., mason@clemson.edu

Example: Relative References On Record the same Macro with Use Relative References on, then click Stop Recording Now the starting cell moves when the macro runs Scott J. Mason, Ph.D., mason@clemson.edu

Example: Relative References On The VBA code: Notice ActiveCell.Offset([#rows],[#cols]) vs. Range(”B1”) Scott J. Mason, Ph.D., mason@clemson.edu

General Steps for Writing a Program Get into VB Editor Add a module Write a sub (or copy it in this case) Run the code from VB Editor Optional (but useful): Add a button to the spreadsheet to run the code We’ll revisit this later in this module! IE 8580, mason@clemson.edu