Submitted By twolf166

Words 98776

Pages 396

Words 98776

Pages 396

Get More and Do More at Dummies.com ®

Start with FREE Cheat Sheets

Cheat Sheets include • Checklists • Charts • Common Instructions • And Other Good Stuff!

To access the Cheat Sheet created specifically for this book, go to

www.dummies.com/cheatsheet/excelvbaprogramming

Get Smart at Dummies.com

Dummies.com makes your life easier with 1,000s of answers on everything from removing wallpaper to using the latest version of Windows. Check out our • Videos • Illustrated Articles • Step-by-Step Instructions Plus, each month you can win valuable prizes by entering our Dummies.com sweepstakes. * Want a weekly dose of Dummies? Sign up for Newsletters on • Digital Photography • Microsoft Windows & Office • Personal Finance & Investing • Health & Wellness • Computing, iPods & Cell Phones • eBay • Internet • Food, Home & Garden

Find out “HOW” at Dummies.com

*Sweepstakes not currently available in all countries; visit Dummies.com for official rules.

Excel VBA Programming

®

FOR

DUMmIES

2ND

‰

EDITION

by John Walkenbach

Excel® VBA Programming For Dummies®, 2nd Edition

Published by Wiley Publishing, Inc. 111 River Street Hoboken, NJ 07030-5774 www.wiley.com Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical,…...

...ADVANCED EXCEL TRAINING Quality Management Objective To provide the participants with an understanding of the advanced features of MS Excel Today is 7/22/2011 2 Advanced ® EXCEL Topics Working with Data Lists Naming Cells and Ranges Conditional Functions Lookup Functions Pivot Tables Data Validation Today is 7/22/2011 3 Naming Cells and Ranges Today is 7/22/2011 4 Name cells by using labels Name cells by using existing row and column labels Select the range you want to name, including the row or column labels. On In the Insert menu, point to Name, and then click Create. the Create names in box, designate the location that contains the labels by selecting the Top row, Left column, Bottom row, or Right column check box. Note A name created by using this procedure refers only to the cells that contain values and does not include the existing row and column labels. Today is 7/22/2011 5 Name a Cell or Range Using Names Box 1. Select the cell or range you want to name. 2. Click the Name box on the formula bar. 3. Type a name for the range. A range name can include uppercase or lowercase letters, numbers, and punctuation, but no spaces. Try to use a simple name that reflects the type of information in the range, such as BookTitle. 4. Press Enter. The range name will appear in the Name box whenever you select the range. Today is 7/22/2011 6 Conditional......

Words: 1579 - Pages: 7

...Project Description: You are an analyst for an art gallery that is an authorized Greenwich Workshop® fine art dealer. You prepared a list of artwork by James Christensen and need to organize the data using an outline, subtotals, PivotTables, and PivotCharts to aid you in analyzing the data, which you will do in this project. Instructions: For the purpose of grading the project you are required to perform the following tasks: Step Instructions Points Possible 1 Start Excel. Download, save, and open the file named Exploring_e05_Grader_EOC.xlsx. 0 2 Sort the data on the Subtotals worksheet first by the Type column, then by the Art column, both in alphabetical order. 4 3 Subtotal the data at each change in Type. Identify the highest issue price, estimated value, and percent increase. 10 4 Add an automatic outline to the Subtotals worksheet. Group the first and last name columns. Collapse the names columns, and then collapse columns created by the outline (G, H, and I). 7 5 Create a PivotTable on a new worksheet using the data on the Christensen worksheet in the range A1:J19. Use the Type, Est. Value, and Issue Price fields and use the default locations in the PivotTable Layout. 8 6 Modify the Issue Price and Est. Value values to determine the average issue price and average estimated market value by type. 6 7 Insert a calculated field named % Change in Value to determine the percent change in values by type. Format the values in the new column as percentages......

Words: 312 - Pages: 2

...An Introduction to VBA in Excel Robert L. McDonald† First draft: November, 1995 November 3, 2000 ∗ Abstract This is a tutorial showing how to use the macro facility in Microsoft Oﬃce—Visual Basic for Applications—to simplify analytical tasks in Excel. Contents 1 Introduction 2 Calculations without VBA 3 How to Learn VBA 4 Calculations with VBA 4.1 Creating a simple function . . . . . . . . . . . . 4.2 A Simple Example of a Subroutine . . . . . . . 4.3 Creating a Button to Invoke a Subroutine . . . 4.4 Functions can call functions . . . . . . . . . . . 4.5 Illegal Function Names . . . . . . . . . . . . . . 4.6 Diﬀerences Between Functions and Subroutines 3 3 4 5 5 7 7 8 9 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ∗ Copyright c 1995-2000 Robert L. McDonald. Thanks to Jim Dana for asking stimulating questions about VBA. † Finance Dept, Kellogg School, Northwestern University, 2001 Sheridan Rd., Evanston, IL 60208, tel: 847-491-8344, fax: 847-491-5719, E-mail: r-mcdonald@northwestern.edu. CONTENTS 2 5 Storing and Retrieving Variables in a Worksheet 5.1 Using a named range to read and write numbers from spreadsheet . . . . . . . . . . . . . . . . . . . . . . . . . 5.2 Reading and Writing to Cells Which are not Named. . . 5.3 Using the “Cells” Function to Read and Write to Cells. 10 the . . . . . . . . . 11 12 13 6 Using Excel Functions 13 6.1 Using VBA to compute the......

Words: 10883 - Pages: 44

...免费下载-分享--Excel VBA 应用教程— 目 录 一、VBA语言基础 ...................................................................................................................1 第一节 第二节 第三节 第四节 第五节 标识符...................................................................................................................................1 . 运算符...................................................................................................................................1 . 数据类型...............................................................................................................................1 . 变量与常量............................................................................................................................1 数组.......................................................................................................................................2 . 第六节 注释和赋值语句....................................................................................................................2 第七节 书写规范...............................................................................................................................2 . 第八节 判断语句...............................................................................................................................2 . 第九节 循环语句...............................................................................................................................3 . 第十节 其他类语句和错误语句处理......................................................................

Words: 27477 - Pages: 110

...Function keys editing in a cell is turned off SHIFT+F2 adds or edits a cell comment. in excel ALT+F1 creates a chart of the data in the current range ALT+SHIFT insert a new worksheet Edits the active cell and positions the insertion point at the end of the cell contents. It also moves the insertion point into the Formula Bar when CTRL+F2 displays the Print Preview window When a cell reference or range is selected in a formula, F4 cycles through the various combinations of absolute and relative references. CTRL+F4 closes the selected workbook window Switches between the worksheet, Ribbon, task pane, and Zoom controls. In a worksheet that has been split (View menu, Manage This Window, Freeze Panes, Split Window command), F6 includes the split panes when switching between panes and the Ribbon area. SHIFT+F6 switches between the worksheet, Zoom controls, task pane, and Ribbon. CTRL+F6 switches to the next workbook window when more than one workbook window is open. Calculates all worksheets in all open workbooks. SHIFT+F9 calculates the active worksheet. CTRL+ALT+F9 calculates all worksheets in all open workbooks, regardless of whether they have changed since the last calculation. CTRL+ALT+SHIFT+F9 rechecks dependent formulas, and then calculates all cells in all open workbooks, including cells not marked as needing to be calculated. CTRL+F9 minimizes a workbook window to an icon. Creates a chart of the data in the current range. SHIFT+F11 inserts a new......

Words: 274 - Pages: 2

...Microsoft Excel 2010 Formulas & Functions Table of Contents Excel 2010 Formulas & Functions ……………………………………………….….. o Formula Basics ……………………………………………….….. o Order of Operation ……………………………………………….….. Conditional Formatting ……………………………………………….….. Cell Styles ……………………………………………….….. Formulas & Functions ……………………………………………….….. Basic Formulas ……………………………………………….….. o Add the Values in Rows or Columns ……………………………………………….….. o Find the Average, Maximum, or Minimum ……………………………………………….….. Ranges & Individual Cells ……………………………………………….….. Copy a Formula ……………………………………………….….. o Using the Fill Handle ……………………………………………….….. o Using Traditional Copy & Paste ……………………………………………….….. Referencing Cells in Formulas ……………………………………………….….. o Relative References ……………………………………………….….. o Absolute References ……………………………………………….….. o Mixed References ……………………………………………….….. o References to Other Worksheets ……………………………………………….….. o Other Workbook References ……………………………………………….….. Quick Reference Guide ……………………………………………….….. o Add, Subtract, Multiple & Divide ……………………………………………….….. o Understanding Error Values ……………………………………………….….. Practical Purposes of Excel Formulas ……………………………………………….….. o Using Date & Time Formulas ……………………………………………….….. Commonly Used Functions & Formulas ……………………………………………….….. o Math & Trig Icon ……………………………………………….….. Logical Icon ……………………………………………….….. Lookup & Reference Icon ……………………………………………….….. Date & Time Icon ……………………………………………….….. AutoSum Icon ……………………………………………….…........

Words: 5629 - Pages: 23

...Excel VBA Programming Dummies Outline and Notes Jason Xu II: How VBA Works with Excel Chapter 3: Working in the Visual Basic Editor * To continue a single line of code from one line to the next, end the first line with a space followed by an underscore (_) * Option Explicit, inserted at the beginning of a VBA Module, forces variables to be defined (Should always use). Chapter 4: Introducing the Excel Object Model * A collection is a group of objects of the same type. * Workbooks: A collection of all currently open Workbook objects * Worksheets: A collection of all Worksheet objects contained in a particular Workbook object * Sheets: A collection of all sheets (regardless of their type) contained in a particular Workbook object. Contains both Worksheets and Charts. * Etc…. (collections are plural) * Referring to Objects * To reference a single object from a collection, you put the object’s name or index number in parentheses after the name of the collection: * Worksheets(“Sheet1”) * Excel won’t be able to identify the object if the quotation marks are omitted. * If Sheet1 if the first (or only) worksheet in the collection, you can also use the following reference: * Worksheets(1) * If referring to an object by its index number, use a plain number without quotation marks. * Navigating through the hierarchy * Application is at top of the hierarchy * Move...

Words: 2094 - Pages: 9

...New Perspectives Excel 2013 Tutorial 3: SAM Project 1a Spring Software ENHANCE A TIMESHEET Project Goal M Project Name Project Goal New Perspectives Excel 2013 Tutorial 3: SAM Project 1a Spring Software ENHANCE A TIMESHEET Project Goal M Project Name Project Goal PROJECT DESCRIPTION Devon Hastings is the human resources director for Spring Software, a software development company in Cambridge, Massachusetts. He has created a workbook for employees to use in recording the hours they work. He would like your help finishing the timesheet. GETTING STARTED * Download the following file from the SAM website: * NP_Excel2013_T3_P1a_FirstLastName_1.xlsx * Open the file you just downloaded and save it with the name: * NP_Excel2013_T3_P1a_FirstLastName_2.xlsx * Hint: If you do not see the .xlsx file extension in the Save file dialog box, do not type it. Excel will add the file extension for you automatically. * With the file NP_Excel2013_T3_P1a_FirstLastName_2.xlsx still open, ensure that your first and last name is displayed in cell B6 of the Documentation sheet. If cell B6 does not display your name, delete the file and download a new copy from the SAM website. PROJECT STEPS 1. On the Employee List worksheet, select cells A1:B1 and then use the Format Painter copy the format only to the range A2:B9. 2. In cell B1 enter bs001, in cell B2 enter cg001, in cell B3 type dh001, and then use Flash......

Words: 790 - Pages: 4

...Excel 2013 Help Page 1 of 8 Keyboard shortcuts in Excel This article describes what Key Tips are and how you can use them to access the ribbon. It also lists Ctrl combination shortcut keys, function keys, and some other common shortcut keys for Microsoft Excel 2013. In this article Keyboard access to the ribbon Will my old shortcuts still work? Ctrl combination shortcut keys Function keys Other useful shortcut keys Keyboard access to the ribbon If you're new to the ribbon, the information in this section can help you understand the ribbon's keyboard shortcut model. The ribbon comes with new shortcuts, called Key Tips. To make the Key Tips appear, press Alt. To display a tab on the ribbon, press the key for the tab—for example, press the letter N for the Insert tab or M for the Formulas tab. This makes all the Key Tip badges for that tab's buttons appear. Then, press the key for the button you want. Will my old shortcuts still work? Keyboard shortcuts that begin with Ctrl will still work in Microsoft Excel 2013. For example, Ctrl+C still copies to the clipboard, and Ctrl+V still pastes from the clipboard. Most of the old Alt+ menu shortcuts still work, too. However, you need to know the full shortcut from memory — there are no screen reminders of what letters to press. For example, try pressing Alt, and then press one of the old menu keys E (Edit), V (View), I (Insert), and so on. A box pops up saying you're using an access key from an earlier version of......

Words: 2819 - Pages: 12

...Linear Programming: Using Solver in Excel Linear Programming was conceptually developed before World War II by the outstanding Russian mathematician A.N.Kolmogorov and gained its popularity ever since the development of Simplex method by George B. Dantzig in 1947. Linear programming deals with problems of maximizing or minimizing a linear function in the presence of linear equality and/or inequality constraints. In these problems, we find the optimal, or most efficient way of using limited resources to achieve the objective of the situation. Linear Programming enables users to model large and complex problems and solve in a short amount of time by the use of effective algorithm, hence it is a powerful and widely used tool in various fields such as science, industrial engineering, financial planning and management decision making. Nowadays, with the development of technology, most of the real world Linear Programming problems are solved by computer programs. Excel Solver is a popular one. We work through different examples to demonstrate the applications of linear Programming model and the use of Excel Solver for various decision making in operation and supply chain management. Components of Linear Programming model To solve the linear programming problems, we first need to formulate the mathematical description called a mathematical model to represent the situation. Linear programming model usually consists of the following components * Decision variables: These......

Words: 2395 - Pages: 10

...P rate and y = T P rate. Possible values range from (0, 0) to (1, 1). The “classiﬁcation” that assigns “Test Negative” to every score has FP rate of 0 and TP rate of 0, represented as point (0, 0). The “classiﬁcation” that assigns “Test Positive” to every value has FP rate of 1 and TP rate of 1, represented as the point (1, 1). Joining all known (x, y) points by straight lines, the area under the resulting empirical ROC curve is known as the Area Under the Curve or AUC. The AUC ranges from 0.5, for a test no better than chance, to 1, for a perfect test. The Area Under the Curve is calculated by the summation of the average height multiplied by the width, as follows: ! ! T P (n) + T P (n + 1) 1 2 (F P (n + 1) F P (n)) See Excel Spreadsheets for examples of calculating each point on an empirical ROC Curve. 2 2.1 2.1.1 Information Measures Probability Review Basic Probability Deﬁnitions Joint probability: p(X, Y ) The probability that both X and Y are true. Joint probability is commutative: p(X, Y ) = p(Y, X). Conditional probability: p(X|Y ) The probability that X is true, given that Y is true. Note that “Rates,” PPV and NPV are Conditional Probabilities: True Positive Rate = p(T P T est|+), 3 False Negative Rate = p(F N T est|+), False Positive Rate = p(F P T est| ), True Negative Rate = p(T N T est| ), Positive Predictive Value = p(+|T est P ositive), Negative Predictive Value = p( |T est N egative). Marginal probability:......

Words: 4475 - Pages: 18

...How to access VBA in excel 2013: Excel option—quickaccess toolbar—customized ribbonr—developer or just alt+F11 How to access VBA in excel 2013: Excel option—quickaccess toolbar—customized ribbonr—developer or just alt+F11 VBA 1. VBA format: a. upper left corner: project: * Automatically created when create a new workbook * Only one project per workbook * Can contain on or more modules; modules are VBA codes, which is separated into macros or procedure; macro is a set of instructions for the computer written in VBA, which is text readable. 2. Reason why create macros is to manipulate data in workbook environment 3. Programming language: Sub myfirstmacro() Commentary will automatically be green Commentary will automatically be green ‘my first macro ‘This is commentary Sheets(”Sheet 1”). Select Range (“A3”).Select ActiveCell. Value = 5 Sheets(“Sheet 1”). Select Range (“B2). Select ActiveCell. Value=62 End Sub 4. Variables: Ex1: a=a+1, if a = 5, a now is 6. Previous value of a is not existed any more. Ex2: c= “hi all!”. Words must be included in quotation mark. Ex3: d=c&”Bye!” comes to hi all!bye! a. variable names: * Must begin with a letter * Only can be letters, numbers and underscores * <=255 characters * Cannot be special reserved word like print or save 5.programming language2 Sub mathfun() Sheets("sheet1").Select Range("B3").Select a = ActiveCell.Value Range("B4").Select Summy is variable of sum...

Words: 1906 - Pages: 8

...Applied Statistics Microsoft Excel Decomposition may reduce appeal emphasis on applications. Flow charts help make the analysis decision by identifying technique, computing statistics, and interpreting results. Associated data set accompanies the set purports to build a excel spreadsheet that discovers formula, illustrates the parameters, observes dynamic graphs and simulations that recodes, edits, validate, charts, and automatically links equations, data, and formulas to recalculate the data analysis. Excel recognizes statistical capability conjunction that carries out complex algorithms that implement correlated data columns. Excel quickly analyzes and interprets information filtered into a spreadsheet so the process is much easier then working out these formulas by hand. Excel spreadsheets create charts, graphs, and filters data all into one. Excel uses all of the basic mathematical operations such as addition, subtraction, division, and multiplication. Fractions and decimals are just as common for interpretation data into a excel spreadsheet. An advantage about excel is you can place any formula into the spreadsheet whether in ascending or descending order and using the same formula, it will automatically compute the answer for the next equation. Another advantage is if information is inaccurate, you can go back and check your work with just a click, unlike using y calculations or by hand you have to erase so much and start all over again, which could be time......

Words: 377 - Pages: 2

...Operator: <= / Constraint entry: d9*32% 3. Laser Imaging machines (D7) should be greater than or equal to 28% of the total machines produced (d9*28%); also enter a constraint for less than or equal to 32% (d9*32%) 4. Magnes machines (D8) should be greater than or equal to 38% of the total machines produced (d9*38%); also enter a constraint for less than or equal to 42% 5. Number to make (D6:D8) must be whole units (use int) Verify that all parameters have been entered (set objective, changing cells and constraints), Solve and create an Answer Report. Resave your practice exam. This will still be a macro-enabled file. If you want feedback on your practice exam, please upload your file to Oncourse / Assignment 2 / Excel Case Practice link. On test day you will submit your completed exam to the Oncourse Assignment2 link....

Words: 1218 - Pages: 5

...Terms Definitions The First step in creating an effective workseet is to make sure you __________. Understand what is required In Excel, a number can contain the charaters ________. 0 1 2 3 4 5 6 7 8 9 The cell being copied is called the source area (copy area). The range of cells recieving the copy is called the ________. receiving range You ________ a worksheet to emphasize certain entires and make the worksheet easier to read and understand. Format Pressing the _________ keyboard shorcut key(s) selects cell A1. CTRL + HOME How many chart types does Excel offer? 11 Which of the following keys is an alternative to double-clicking the cell to edit it? F2 Which of the following Opton buttons gives options for filling cells following a fill operation? Auto Fill Options A ________ cell in Excel has a numerical value of zero. Blank The ________ AutoComplete list contains those functiond that akohabetically match the letters you type following thr equal sign. Formula The most popular background color is _______. White ________ text often provides a strong visual appeal. Underlined To open the format cells dialog box with the Alignment sheet active, click the Format Cells ________. Dialog Box Launcher Which of the following is an extension of the fill patten Sunday, Tuesday? Thursday, Saturday, Monday Which of the following formula contains the absolute cell reference? =$B$4 A(n) _______ chart provides a simple way to show trends and variatons in a range of data...

Words: 423 - Pages: 2