SlideShare a Scribd company logo
1 of 39
Download to read offline
(isothermtech.com)

Test Your Excel VBA Skills: 8
Engineering Exercises
These course exercises and application
examples are from the 2-day short
course “Engineering Analysis &
Modeling with Excel-VBA”. The
complete set of notes are available in
paperback and kindle formats on
Amazon. In-depth details are presented
on principles, practices, and
implementation of Excel and its
integrated programming environment,
Visual Basic for Applications (VBA), for
analysis and creating engineering
models.
The exercise problems in each section
build upon the previous exercises to
demonstrate new techniques. To obtain
completed exercises and other helpful
Excel-VBA resources, visit:
www.isothermtech.com

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 1: Convection Sheet

(To obtain completed exercises, an electronic version of the notes,
and other helpful Excel-VBA resources, visit: isothermtech.com)

1. Draw the graphics
2. Add the sheet name,
description,
assumptions, &
reference
3. Set up the inputs &
outputs (I/O) as
shown and define the
cell names
4. Use standard cell
equation and the
built-in “IF” function
to check flow regime
5. Format the cells (fill,
border, etc.)
6. Start documenting
the equations
© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 1: Convection Sheet - Hints
• Resize the “A” column by
dragging the separator line
to make room for the
graphics
• Use the cylinder (“can”)
from the menu and use the
green edit circle to rotate it
(optional: add black “hole”
at pipe end)
• Use the arrow icon to add
flow arrows
• Experiment with the
Equation Editor:
– Fraction notation
– Subscript & superscripts

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 2: Convection VBA

© 2014 Matthew E. Moran

1. Insert a module
2. Declare the variables
using “Dim”
3. Add the functions
shown to calculate the
outputs, and call them
from the worksheet
4. Include a friction factor
function called by the
Nusselt function
5. Use the debugger and
locals window to try out
the procedures
6. Optional: Use the
macro recorder to
change the fill color of
a cell, then edit the
macro & interpret it
using VBA Help
excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 2: exercises, an electronic version of the notes,
Convection VBA - Hints
(To obtain completed
and other helpful Excel-VBA resources, visit: isothermtech.com)

• Select the target
cell, and use the
“fx” icon and the
“user defined”
category to find
your created
functions
• Click in front of
any line of code to
create a toggle
breakpoint for
debugging
• Open the locals
window to watch
variables
• Step into the code
to observe
execution
© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 3: Fluid Properties

1. Add a new sheet called “Fluid
Properties”
2. Fill in the property data shown
3. Create plots for all the
properties vs temperature
4. Add trendlines (curve fits) for
each property
5. Create a function that calculates
the properties using the curve fit
equations & try it out from the
worksheet

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 3: Fluid Properties - Hints
(To obtain completed exercises, an electronic version of the notes,
and other helpful Excel-VBA resources, visit: isothermtech.com)

• Right click any cell to access
formatting options (or use
menu/ribbon)

– Select wrap text to auto-size the
cell to fit the text
– The font of individual characters
can be made superscripts

• Make a scatter plot of the data

– For noncontiguous data, use the
“ctrl” key while selecting the
cells
– Right click on chart axis to
change the scale

• Add a trendline by right clicking
on a data point & choosing
Note: Curve fitting of properties in this
settings
exercise is for illustrative purposes
only. Better approaches include: NIST
Refprop (or online webbook),
equations of state, or interpolation of
high fidelity tabular data
© 2014 Matthew E. Moran

– Right click the curve fit equation
to format as scientific with 2
digits after the decimal (in
≤2003, double click curve fit
equation to set format)

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 4: Condenser

1. Add a “Condenser” sheet & create a
condenser sketch as shown
2. Make a button to open a message
3. Add the data for pipe diameter,
water velocity, and water bulk temp
4. Create a new function in “Module 1”
that calls the existing functions to
calculate film heat transfer coeff’s
5. Call the new function from the sheet
6. Create a scatter plot of film coeff vs
pipe diameter (change temperature
to 30… what happens to the plot?)

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 4: Condenser - Hints

(To obtain completed exercises, an electronic version of the notes,
and other helpful Excel-VBA resources, visit: isothermtech.com)

• Use the “ctrl-D” keys
together to duplicate
selected graphics
• Right click the button
to add code
• Call the new
“AutoHTcoeff”
function from the first
cell in the film coeff
column

– Use the “knuckle” to
drag the first cell down to
the remaining cells
– Since this equation uses
the default relative cell
reference, the function
call is updated with the
appropriate inputs

• Optional: add link to
the “Fluid Properties”
sheet for NIST data
source
© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 5: Properties version of the notes,
Userform
(To obtain completed exercises, an electronic
and other helpful Excel-VBA resources, visit: isothermtech.com)

1. Insert a userform in the
VBA Editor
2. Name the form
“frmProperties” and
change the caption to
“Properties Calculator”
3. Use Label, TextBox,
ComboBox and
CommandButton controls
to build the userform
shown
4. Name the controls using
the prefix nomenclature:
•
•
•
•
•
•
•
•
•

© 2014 Matthew E. Moran

lblTemp
txtTemp
lblProp
cboProp
lblValue
txtValue
txtUnits
cmdCalculate
cmdClose

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 5: Properties Userform (cont)
5. Right click on the cmdCalculate userform
button and add the code shown
6. Right click on the cmdClose userform
button and add the code shown
7. Go to the “Fluid Properties” sheet,
add a button, change the caption to
“Property Userform”, right click on the
button and add the code shown

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 5: Properties Userform - Hints
• To name controls, make sure the properties
window is open, select the control, and edit
the “(Name)” property (the “Caption”
property is accessed the same way)
• Optional: try setting up validation for the
temperature cell of the worksheet property
calculator, and drop down selection for the
units cell, using data validation

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 6: Pipe Design
(To obtain completed exercises, an electronic version of the notes,
and other helpful Excel-VBA resources, visit: isothermtech.com)

1. Use Goal Seek to
find out what
velocity gives a
Reynolds number of
2300 for a pipe
diameter of 0.01 m
and bulk temp of 25
C
2. Create a Diameter
Trade button on the
Pipe HT sheet, and
add the code shown
on the next slide
3. Create an Echo
Data button & add
the code shown on
the next slide
4. Try changing the
velocity value to 1 in
the input cell, then
run the Diameter
Trade again
© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 6: Pipe Design - Hints
•

•

•

© 2014 Matthew E. Moran

Right click on the
buttons to change the
captions & create the
associated code
Remember the syntax is
“Cells(Row#,Col#)”, not
the other way around as
is typical in cell
references on the
worksheet side (i.e. cell
“D2” would be
referenced as “Cell(2,4)”
in VBA)
In this exercise, the
Cells and Range objects
can be accessed
without specifying
parent objects (e.g.
Worksheet) since all the
“action” is occuring on
one active sheet

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 7: Optimize Pipe
1. Use Solver on the
Pipe HT sheet to find
the maximum heat
transfer coeff given
the constraints shown
2. Select the Answer
report and diagnose
which variables the
solution “bumped up
against”
3. Save the Solver model
on the Pipe HT sheet
4. Add code to the
Property function that
returns an “Out of
Range” message if the
temp is not 0-100 C

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 7: Optimize Pipe - Hints
(To obtain completed exercises, an electronic version of the notes,
and other helpful Excel-VBA resources, visit: isothermtech.com)

• You can select cells
for Solver by
clicking on them
• Solver may initially
show cell
references instead
of defined names
when setting it up
for the first run
• Use the “Options”
button in the Solver
window to save the
model, and select a
location on the
sheet with empty
vertical cells
© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 8: System Sheet

(To obtain completed exercises, an electronic version of the notes,
and other helpful Excel-VBA resources, visit: isothermtech.com)

1. Add a system sheet and
create the graphics shown
2. Make a hyperlink from the
Condenser box that goes to
the Condenser sheet
3. Select the input cells on the
Pipe HT sheet change the
format protection to unlock
the cells (do the same with
columns G - J)
4. Protect the sheet with a
blank (null) password (now
try modifying cells)
5. Hide the Answer sheet
6. Add a “Worksheets?”
button on the System sheet
and create the code shown
on the next slide to count
and list names of the
sheets (how does it handle
the hidden sheet?)
© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Exercise 8: System Sheet - Hints
(To obtain completed exercises, an electronic version of the notes,
and other helpful Excel-VBA resources, visit: isothermtech.com)

•

•

•

© 2014 Matthew E. Moran

Hyperlink the
condenser by right
clicking on the
object and
choosing the
Condenser sheet
Be sure to unlock
input cells before
protecting the
sheet
Optional: Try
getting rid of the
column & row
headings and the
gridlines on the
Condenser sheet

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

© 2014 Matthew E. Moran

Application: Simple Calc Sheet

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Application: Another Calc Sheet

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Application: Multilayer Insulation (cont)

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Application: SOTV Spacecraft (cont)

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

© 2014 Matthew E. Moran

Application: Cryo Tank Design

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

© 2014 Matthew E. Moran

Application: Fuel Cell (cont)

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
Isotherm Technologies LLC (www.isothermtech.com)

Engineering Analysis & Modeling

(isothermtech.com)

with Excel-VBA
Version 8.0

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
Table of Contents

(isothermtech.com)

INTRODUCTION
Table of Contents
Course Description
Course Feedback
Course Materials
Intended Audience & Use
How to Use These Notes
Instructor Bio
Course Summary
Learning Objectives
Topics: Design & Build
Topics: Refine & Optimize
Modeling Options
Advantages of Excel/VBA
Excel + VBA
Some Mac Tips
Basic Settings
Security Settings

© 2014 Matthew E. Moran

1 EXCEL REVIEW
22 VBA INTRODUCTION
2 Appl: Simple Calc Sheet 23 Appl: Another Calc Sheet
6 Workbook Environment
24 VBA – Accessing
7 Autofill & Absolute Refrs 25 Visual Basic Editor
8 Naming Cells & Ranges
26 Project & Properties
9 Names Management
27 Modules
10 Add-Ins (Built-In)
28 User Defined Functions
11 Analysis ToolPak
29 Sub Procedures
12 Functions (Built-In)
30 Functions vs Subs
13 Functions - Using
31 Function & Sub Tips
14 Sheet Structure & Linking 33 Debugging Tools
15 Cell Formatting
34 Programming Aids
16 Equation Object
35 Variables – Declaring
17 Graphics
38 Variables – Types
18 Control Toolbox
40 Variables – Tips
19 Form vs ActiveX Controls 43 Object Structure
20 Ex 1: Convection Sheet
44 Object Oriented Prog
21 Ex 1: Hints
45 Recording Macros

46
47
48
49
50
52
53
56
59
60
61
62
63
64
65
66
67
68

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Macros – Editing
Help – Excel
Help – VBA
Excel & VBA Together
Ex 2: Convection VBA
Ex 2: Hints

Table of Contents (cont)
70
71
72
73
74
75

DESIGN & BUILD
76
Appl: Heat Leak
77
Model Definition
82
System Decomposition
83
Prototyping – Ins & Outs 84
Prototyping – Calculations 85
Prototyping – Last Step
86
Curve Fitting – Continuous 87
Curve Fitting Steps
88
Curve Fitting – Final Step 91
Curve Fitting – Error
92
Curve Fitting – Piecewise 93
© 2014 Matthew E. Moran

Manual Digitizing
94 User Forms – Coding
126
IF Statements
96 User Forms – Controls
128
Select Case
97 Userforms – Data I/O
129
Curve Fits – Programming 98 VBA Naming Conventions130
Documenting Data & Refrs 99 Navigating Within Models 131
Ex 3: Fluid Properties
101 Cell Comments
134
Ex 3: Hints
102 Cell Validation
135
Appl: Microsystem
103 Validation – Drop Down 137
Plots – Interactive
106 Warning & Error Msgs
138
Graphics – Manipulating 107 Ex 5: Properties Userform139
Messages
108 Ex 5: Hints
141
Start-Up Control
110
Hyperlinks
111 REFINE & OPTIMIZE
142
ActiveX Controls
113 Appl: MEMS Heat Ex
143
Buttons
115 Scenarios
147
Ex 4: Condenser
117 Scenarios – Setting Up 148
Ex 4: Hints
118 Scenario Summary
150
Appl: Multilayer Insulation 119 Summary Automation
151
User Forms
125 Named Variables – Listing154

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Table of Contents (cont)

Sensitivity Analysis
155
Goal Seek
156
Appl: SOTV Spacecraft 159
For & Do Loops
164
Arrays – Intro
165
Arrays – Creating
166
Arrays – Passing in VBA 167
Arrays – From Worksheet 168
Arrays – To Worksheet 169
Arrays – Dynamic
170
Cells – Reading Data
171
Cells – Writing Data
172
Number Formats
173
Ex 6: Pipe Design
174
Ex 6: Hints
175
Appl: Cryo Tank Design 176
Modifying Excel Features 179
Solver
180
Solver – Initial Use
181
© 2014 Matthew E. Moran

Solver – Settings
Solver – Simple Example
Solver – Saving Models
Solver – Loading Models
Solver – Tips
Ex 7: Optimize Pipe
Ex 7: Hints
Appl: Fuel Cell
Systems Diagrams
Interdisciplinary Models
Collab Lessons Learned
Configuration Control
Distr & Version Control
Export & Import Modules
Add-Ins (Custom)
Hiding Rows & Columns
Hiding Worksheets
Hiding & Locking Cells
Protecting Workbooks

182 Protecting VBA
207
183 Appl: Electronics Cooling 208
187 Flexibility & Extensibility 209
188 Format for Printing
210
189 Integ with Other Docs
211
191 Strings (Characters)
212
192 Ex 8: System Sheet
213
193 Ex 8: Hints
214
195
196 App A: Upgrading from
197 Excel 2003
215
216
198 Reviving Legacy Files
199 Excel 2007 New Features 217
218
200 Excel Size Limitations
201 Excel 2007 VBA Changes219
220
203 Getting Started
221
204 Command Guide
205
206

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
Table of Contents (cont)

(isothermtech.com)

App B: Excel 2003
and Earlier Versions
Settings - Security ≤2003
Settings – Options ≤2003
Naming Cells ≤2003
Names - Using ≤2003
Analysis ToolPak ≤2003
Sheets & Linking ≤2003
Cell Formatting ≤2003
Equation Object ≤2003
Graphics ≤2003
Graphics ≤2003(cont)
Control Toolbox ≤2003
VBA – Accessing ≤2003
Sub Proc’s ≤2003(cont)
Recording Macros ≤2003
Recording ≤2003(cont)
Help - Excel ≤2003
Curve Fitting ≤2003
© 2014 Matthew E. Moran

Curve Fitting ≤2003(cont) 240
Data & Refrs ≤2003(cont) 242
ActiveX Controls ≤2003 244
Buttons ≤2003
245
Cell Validation ≤2003
246
Scenarios – Setup ≤2003 247
Goal Seek ≤2003
248
Customize Look ≤2003 249
Modify Features ≤2003 250
Solver – Initial Use ≤2003 251
Solver - Settings ≤2003 252
Protecting Wrkbks ≤2003 253
Format for Printing ≤2003 254
Format ≤2003 (cont)
255

222
223
224
225
226
227
228
229
230
231
232
233
234
235
236 App C: Functions in Excel &
237 Visual Basic
256
238 Excel Fcn Categories
257
239 Functions – Compatibility 258

Functions – Cube
Functions – Database
Functions – Date & Time
Functions – Engineering
Functions – Financial
Functions – Information
Functions – Logical
Functions – Lookup &Ref
Functions – Math & Trig
Functions – Statistical
Functions – Text
Functions – UDF & Web
Functions – VB Conv
Functions – VB Math
Functions – VB String

260
261
262
264
267
270
271
272
273
277
283
285
286
288
290

Index of Topics
Testimonials

292
296

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Course Description

These course notes (available in paperback
and kindle formats) are from the 2-day short
course entitled “Engineering Analysis &
Modeling with Excel-VBA”. In-depth details
are presented on principles, practices, and
implementation of Excel and its integrated
programing language – Visual Basic for
Applications (VBA) – for analysis and
engineering model creation.

The exercise problems in each section build
upon the previous exercises to demonstrate
new techniques. To obtain completed
exercises and other helpful Excel VBA
resources, visit: www.isothermtech.com.
© 2014 Matthew E. Moran

FEEDBACK ON SELF-STUDY
USING THE COURSE NOTES
"I worked through the course
materials of 'Engineering Analysis
& Modeling w/Excel/VBA' and
would highly recommend it to
other engineers.", Maury DuPont,
University of Cincinnati
"...the exercises were very easy to
understand... followed extremely
well after the learning slides that
came before them. The
instructions were detailed enough
to understand, but still left
enough leeway for individual
learning", Monica Guzik, RoseHulman Institute of Technology

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Course Feedback

“Great material, great presentation”, William J. Armiger, Naval Research Laboratory
“Lots of useful information, and a good combination of lecture and hands-on”, Brent Warner,
Goddard Space Flight Center
“Excellent course documentation... excellent communicator”, Linda Hornsby, Jacobs ESTS
Group
“Very knowledgeable... presented clearly and answered all questions”, Marc Wilson, Johns
Hopkins University Applied Physics Laboratory
“Great detail… informative and responsive to questions. Offered lots of useful info to use
beyond the class”, Sheleen Spencer, Naval Research Laboratory
“Excellent… Good overview of VBA programming…”, John Yocom, General Dynamics
“Really enjoyed how much info was passed along in such a short and easily understandable
method”, Will Rehlich, Noren Products
“Good introduction and quick functioning using VBA was enabled by this course”, Michael R.
Palis, Hybricon Corp.
“I’ve been looking for a course like this for years! Matt was very knowledgeable and
personable and walked his talk”, James McDonald, Crown Solutions
“Gave me a lot to work with. Very helpful and hands on. [My favorite parts?]... It was all good”,
Dale Folsom, Battelle
“Matt was extremely knowledgeable and a great instructor”, Jennifer Snelling, Barrios Technology
© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Course Materials
Visit www.isothermtech.com
to get a variety of course
materials and resources:
• Course notes in paperback
and kindle formats
• Excel files containing
worked-out copies of all
the course exercises
• Helpful reports and online
resources
• Sample slides and
exercises
• Training course videos
• Upcoming course offerings

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Intended Audience & Usage

These course notes are intended for practicing engineers, scientists and
others with an interest in analysis and modeling. It is targeted toward
intermediate to advanced Excel users, although no prior experience with VBA
is assumed. If you are new to Excel, you should consider supplementing these
notes with an introductory course or book.
You may occasionally hear or read the opinion that Excel is not an
appropriate tool for engineers. This is nonsense. The instructor has used
many engineering software tools for more than three decades (e.g. general
math, finite difference, FEA, CFD, CAE, DAQ, system simulation, custom
codes, etc.), and they all have their place. Excel has a rich set of features for
calculation, visual display and user interaction that makes it a very good
general tool for many engineering and other technical computations. With its
built-in VBA programming environment, and the associated techniques taught
in these course notes, it becomes a highly versatile platform. Nonetheless,
there is no substitute for good professional judgment in choosing the right tool
for the job. There are certainly applications where Excel isn’t the best choice or even a viable option in some cases.
It’s important to remember that the quality of all analytical results are
dependent on a user’s skills, knowledge, experience, discipline, and work
quality. Any software tool will provide poor results if used improperly, although
some tools hide it better with a polished display! In addition, verification and
validation are always critical, and should be part of any analysis or model
regardless of the tools and methods used. With that in mind, this course
teaches principles and practices with Excel VBA that facilitate quality results.
© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

How to Use These Course Notes
Ways to use the course notes:*
• Self study (paperback or kindle versions)
• Video training (with paperback or kindle version)**
• Course offering (public or hosted)**
Each section uses a sequential teaching methodology:
1) Real world application to illustrate the topics to be covered
2) Introduction to the learning topics and step-by-step details
on how to implement them in Excel VBA
3) Integrated hands on exercise to solidify the topics learned
General format & conventions:
• Screen shots are predominantly used to facilitate
immediate experimentation and rapid learning
• Notes, tips, and step-by-step instructions throughout
• Detailed text limited to topics needing more explanation
• Valuable supplemental info included in the appendices

* Visit www.isothermtech.com for information on video training and upcoming courses
** Video & course offerings can be applied toward PE continuing education requirements
(check with your state or other licensing entity to confirm what types of training qualify)
© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
Instructor Bio

(isothermtech.com)

(Dec, 2013)

Matt Moran is the owner of Isotherm Technologies LLC. He is
also a sector manager and senior engineer at NASA. Matt
teaches engineering analysis seminars throughout the U.S.,
and has been adjunct faculty at the graduate school at Walsh
University and other colleges. He has been a co-founder or
key contributor to the start up of five high tech businesses, and
has worked with hundreds of organizations of varying size,
type and industry sector.

Matt has 32 years experience developing products and systems for
aerospace, electronics, military, and power generation applications. He has
used many software tools for analysis and modeling. Matt has created Excel
VBA engineering system models for DARPA, Air Force, Office of Naval
Research, Missile Defense Agency, NASA and various commercial
organizations.

Matt is a Professional Engineer (Ohio), with a B.S. & graduate work in
Mechanical Engineering, and an MBA in Systems Management. He has
published 44 papers and a book; and has 3 US patents.
© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Course Summary
This course will provide the
knowledge and methods to create
custom engineering models for…
 Analyzing conceptual designs
 Creating system trades
 Simulating operation
 Optimizing performance
…with Excel VBA.
The instructor has been using
spreadsheets for engineering
computations since the early
1980s; and VBA since 1996
(shortly after its integration with
Excel). He has taught these
methods to hundreds of course
participants since 2007.

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Learning Objectives
• Exploit the full power of Excel for
building engineering models
• Master the built-in VBA
programming language
• Implement advanced data I/O,
manipulation, analysis, and display
• Create full featured graphical
interfaces and interactive content
• Optimize performance for multiparameter systems and designs
• Integrate interdisciplinary
capabilities into engineering
models

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Topics: Design & Build
1.
2.
3.
4.
5.

Excel VBA Review
Identifying Scope & Capabilities
Quick Prototyping
Defining Model Structure
Designing Graphical User
Interfaces
6. Building & Tuning the VBA
Engine
7. Customizing Output Results
8. Exploiting Built-in Excel
Functions
© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
(isothermtech.com)

Topics: Refine & Optimize
9. Integrating External Data
10. Adding Interdisciplinary
Capabilities
11. Unleashing GoalSeek & Solver
12. Incorporating Scenarios
13. Documentation, References, &
Links
14. Formatting & Protection
15. Flexibility, Standardization, &
Configuration Control
16. Other Useful Tips & Tricks
17. Application Topics

© 2014 Matthew E. Moran

excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes

More Related Content

Recently uploaded

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

Featured

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 

Featured (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Test your excel vba skills: 8 engineering exercises

  • 1. (isothermtech.com) Test Your Excel VBA Skills: 8 Engineering Exercises These course exercises and application examples are from the 2-day short course “Engineering Analysis & Modeling with Excel-VBA”. The complete set of notes are available in paperback and kindle formats on Amazon. In-depth details are presented on principles, practices, and implementation of Excel and its integrated programming environment, Visual Basic for Applications (VBA), for analysis and creating engineering models. The exercise problems in each section build upon the previous exercises to demonstrate new techniques. To obtain completed exercises and other helpful Excel-VBA resources, visit: www.isothermtech.com © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 2. (isothermtech.com) Exercise 1: Convection Sheet (To obtain completed exercises, an electronic version of the notes, and other helpful Excel-VBA resources, visit: isothermtech.com) 1. Draw the graphics 2. Add the sheet name, description, assumptions, & reference 3. Set up the inputs & outputs (I/O) as shown and define the cell names 4. Use standard cell equation and the built-in “IF” function to check flow regime 5. Format the cells (fill, border, etc.) 6. Start documenting the equations © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 3. (isothermtech.com) Exercise 1: Convection Sheet - Hints • Resize the “A” column by dragging the separator line to make room for the graphics • Use the cylinder (“can”) from the menu and use the green edit circle to rotate it (optional: add black “hole” at pipe end) • Use the arrow icon to add flow arrows • Experiment with the Equation Editor: – Fraction notation – Subscript & superscripts © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 4. (isothermtech.com) Exercise 2: Convection VBA © 2014 Matthew E. Moran 1. Insert a module 2. Declare the variables using “Dim” 3. Add the functions shown to calculate the outputs, and call them from the worksheet 4. Include a friction factor function called by the Nusselt function 5. Use the debugger and locals window to try out the procedures 6. Optional: Use the macro recorder to change the fill color of a cell, then edit the macro & interpret it using VBA Help excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 5. (isothermtech.com) Exercise 2: exercises, an electronic version of the notes, Convection VBA - Hints (To obtain completed and other helpful Excel-VBA resources, visit: isothermtech.com) • Select the target cell, and use the “fx” icon and the “user defined” category to find your created functions • Click in front of any line of code to create a toggle breakpoint for debugging • Open the locals window to watch variables • Step into the code to observe execution © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 6. (isothermtech.com) Exercise 3: Fluid Properties 1. Add a new sheet called “Fluid Properties” 2. Fill in the property data shown 3. Create plots for all the properties vs temperature 4. Add trendlines (curve fits) for each property 5. Create a function that calculates the properties using the curve fit equations & try it out from the worksheet © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 7. (isothermtech.com) Exercise 3: Fluid Properties - Hints (To obtain completed exercises, an electronic version of the notes, and other helpful Excel-VBA resources, visit: isothermtech.com) • Right click any cell to access formatting options (or use menu/ribbon) – Select wrap text to auto-size the cell to fit the text – The font of individual characters can be made superscripts • Make a scatter plot of the data – For noncontiguous data, use the “ctrl” key while selecting the cells – Right click on chart axis to change the scale • Add a trendline by right clicking on a data point & choosing Note: Curve fitting of properties in this settings exercise is for illustrative purposes only. Better approaches include: NIST Refprop (or online webbook), equations of state, or interpolation of high fidelity tabular data © 2014 Matthew E. Moran – Right click the curve fit equation to format as scientific with 2 digits after the decimal (in ≤2003, double click curve fit equation to set format) excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 8. (isothermtech.com) Exercise 4: Condenser 1. Add a “Condenser” sheet & create a condenser sketch as shown 2. Make a button to open a message 3. Add the data for pipe diameter, water velocity, and water bulk temp 4. Create a new function in “Module 1” that calls the existing functions to calculate film heat transfer coeff’s 5. Call the new function from the sheet 6. Create a scatter plot of film coeff vs pipe diameter (change temperature to 30… what happens to the plot?) © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 9. (isothermtech.com) Exercise 4: Condenser - Hints (To obtain completed exercises, an electronic version of the notes, and other helpful Excel-VBA resources, visit: isothermtech.com) • Use the “ctrl-D” keys together to duplicate selected graphics • Right click the button to add code • Call the new “AutoHTcoeff” function from the first cell in the film coeff column – Use the “knuckle” to drag the first cell down to the remaining cells – Since this equation uses the default relative cell reference, the function call is updated with the appropriate inputs • Optional: add link to the “Fluid Properties” sheet for NIST data source © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 10. (isothermtech.com) Exercise 5: Properties version of the notes, Userform (To obtain completed exercises, an electronic and other helpful Excel-VBA resources, visit: isothermtech.com) 1. Insert a userform in the VBA Editor 2. Name the form “frmProperties” and change the caption to “Properties Calculator” 3. Use Label, TextBox, ComboBox and CommandButton controls to build the userform shown 4. Name the controls using the prefix nomenclature: • • • • • • • • • © 2014 Matthew E. Moran lblTemp txtTemp lblProp cboProp lblValue txtValue txtUnits cmdCalculate cmdClose excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 11. (isothermtech.com) Exercise 5: Properties Userform (cont) 5. Right click on the cmdCalculate userform button and add the code shown 6. Right click on the cmdClose userform button and add the code shown 7. Go to the “Fluid Properties” sheet, add a button, change the caption to “Property Userform”, right click on the button and add the code shown © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 12. (isothermtech.com) Exercise 5: Properties Userform - Hints • To name controls, make sure the properties window is open, select the control, and edit the “(Name)” property (the “Caption” property is accessed the same way) • Optional: try setting up validation for the temperature cell of the worksheet property calculator, and drop down selection for the units cell, using data validation © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 13. (isothermtech.com) Exercise 6: Pipe Design (To obtain completed exercises, an electronic version of the notes, and other helpful Excel-VBA resources, visit: isothermtech.com) 1. Use Goal Seek to find out what velocity gives a Reynolds number of 2300 for a pipe diameter of 0.01 m and bulk temp of 25 C 2. Create a Diameter Trade button on the Pipe HT sheet, and add the code shown on the next slide 3. Create an Echo Data button & add the code shown on the next slide 4. Try changing the velocity value to 1 in the input cell, then run the Diameter Trade again © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 14. (isothermtech.com) Exercise 6: Pipe Design - Hints • • • © 2014 Matthew E. Moran Right click on the buttons to change the captions & create the associated code Remember the syntax is “Cells(Row#,Col#)”, not the other way around as is typical in cell references on the worksheet side (i.e. cell “D2” would be referenced as “Cell(2,4)” in VBA) In this exercise, the Cells and Range objects can be accessed without specifying parent objects (e.g. Worksheet) since all the “action” is occuring on one active sheet excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 15. (isothermtech.com) Exercise 7: Optimize Pipe 1. Use Solver on the Pipe HT sheet to find the maximum heat transfer coeff given the constraints shown 2. Select the Answer report and diagnose which variables the solution “bumped up against” 3. Save the Solver model on the Pipe HT sheet 4. Add code to the Property function that returns an “Out of Range” message if the temp is not 0-100 C © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 16. (isothermtech.com) Exercise 7: Optimize Pipe - Hints (To obtain completed exercises, an electronic version of the notes, and other helpful Excel-VBA resources, visit: isothermtech.com) • You can select cells for Solver by clicking on them • Solver may initially show cell references instead of defined names when setting it up for the first run • Use the “Options” button in the Solver window to save the model, and select a location on the sheet with empty vertical cells © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 17. (isothermtech.com) Exercise 8: System Sheet (To obtain completed exercises, an electronic version of the notes, and other helpful Excel-VBA resources, visit: isothermtech.com) 1. Add a system sheet and create the graphics shown 2. Make a hyperlink from the Condenser box that goes to the Condenser sheet 3. Select the input cells on the Pipe HT sheet change the format protection to unlock the cells (do the same with columns G - J) 4. Protect the sheet with a blank (null) password (now try modifying cells) 5. Hide the Answer sheet 6. Add a “Worksheets?” button on the System sheet and create the code shown on the next slide to count and list names of the sheets (how does it handle the hidden sheet?) © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 18. (isothermtech.com) Exercise 8: System Sheet - Hints (To obtain completed exercises, an electronic version of the notes, and other helpful Excel-VBA resources, visit: isothermtech.com) • • • © 2014 Matthew E. Moran Hyperlink the condenser by right clicking on the object and choosing the Condenser sheet Be sure to unlock input cells before protecting the sheet Optional: Try getting rid of the column & row headings and the gridlines on the Condenser sheet excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 19. (isothermtech.com) © 2014 Matthew E. Moran Application: Simple Calc Sheet excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 20. (isothermtech.com) Application: Another Calc Sheet © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 21. (isothermtech.com) Application: Multilayer Insulation (cont) © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 22. (isothermtech.com) Application: SOTV Spacecraft (cont) © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 23. (isothermtech.com) © 2014 Matthew E. Moran Application: Cryo Tank Design excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 24. (isothermtech.com) © 2014 Matthew E. Moran Application: Fuel Cell (cont) excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 25. Isotherm Technologies LLC (www.isothermtech.com) Engineering Analysis & Modeling (isothermtech.com) with Excel-VBA Version 8.0 © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 26. Table of Contents (isothermtech.com) INTRODUCTION Table of Contents Course Description Course Feedback Course Materials Intended Audience & Use How to Use These Notes Instructor Bio Course Summary Learning Objectives Topics: Design & Build Topics: Refine & Optimize Modeling Options Advantages of Excel/VBA Excel + VBA Some Mac Tips Basic Settings Security Settings © 2014 Matthew E. Moran 1 EXCEL REVIEW 22 VBA INTRODUCTION 2 Appl: Simple Calc Sheet 23 Appl: Another Calc Sheet 6 Workbook Environment 24 VBA – Accessing 7 Autofill & Absolute Refrs 25 Visual Basic Editor 8 Naming Cells & Ranges 26 Project & Properties 9 Names Management 27 Modules 10 Add-Ins (Built-In) 28 User Defined Functions 11 Analysis ToolPak 29 Sub Procedures 12 Functions (Built-In) 30 Functions vs Subs 13 Functions - Using 31 Function & Sub Tips 14 Sheet Structure & Linking 33 Debugging Tools 15 Cell Formatting 34 Programming Aids 16 Equation Object 35 Variables – Declaring 17 Graphics 38 Variables – Types 18 Control Toolbox 40 Variables – Tips 19 Form vs ActiveX Controls 43 Object Structure 20 Ex 1: Convection Sheet 44 Object Oriented Prog 21 Ex 1: Hints 45 Recording Macros 46 47 48 49 50 52 53 56 59 60 61 62 63 64 65 66 67 68 excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 27. (isothermtech.com) Macros – Editing Help – Excel Help – VBA Excel & VBA Together Ex 2: Convection VBA Ex 2: Hints Table of Contents (cont) 70 71 72 73 74 75 DESIGN & BUILD 76 Appl: Heat Leak 77 Model Definition 82 System Decomposition 83 Prototyping – Ins & Outs 84 Prototyping – Calculations 85 Prototyping – Last Step 86 Curve Fitting – Continuous 87 Curve Fitting Steps 88 Curve Fitting – Final Step 91 Curve Fitting – Error 92 Curve Fitting – Piecewise 93 © 2014 Matthew E. Moran Manual Digitizing 94 User Forms – Coding 126 IF Statements 96 User Forms – Controls 128 Select Case 97 Userforms – Data I/O 129 Curve Fits – Programming 98 VBA Naming Conventions130 Documenting Data & Refrs 99 Navigating Within Models 131 Ex 3: Fluid Properties 101 Cell Comments 134 Ex 3: Hints 102 Cell Validation 135 Appl: Microsystem 103 Validation – Drop Down 137 Plots – Interactive 106 Warning & Error Msgs 138 Graphics – Manipulating 107 Ex 5: Properties Userform139 Messages 108 Ex 5: Hints 141 Start-Up Control 110 Hyperlinks 111 REFINE & OPTIMIZE 142 ActiveX Controls 113 Appl: MEMS Heat Ex 143 Buttons 115 Scenarios 147 Ex 4: Condenser 117 Scenarios – Setting Up 148 Ex 4: Hints 118 Scenario Summary 150 Appl: Multilayer Insulation 119 Summary Automation 151 User Forms 125 Named Variables – Listing154 excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 28. (isothermtech.com) Table of Contents (cont) Sensitivity Analysis 155 Goal Seek 156 Appl: SOTV Spacecraft 159 For & Do Loops 164 Arrays – Intro 165 Arrays – Creating 166 Arrays – Passing in VBA 167 Arrays – From Worksheet 168 Arrays – To Worksheet 169 Arrays – Dynamic 170 Cells – Reading Data 171 Cells – Writing Data 172 Number Formats 173 Ex 6: Pipe Design 174 Ex 6: Hints 175 Appl: Cryo Tank Design 176 Modifying Excel Features 179 Solver 180 Solver – Initial Use 181 © 2014 Matthew E. Moran Solver – Settings Solver – Simple Example Solver – Saving Models Solver – Loading Models Solver – Tips Ex 7: Optimize Pipe Ex 7: Hints Appl: Fuel Cell Systems Diagrams Interdisciplinary Models Collab Lessons Learned Configuration Control Distr & Version Control Export & Import Modules Add-Ins (Custom) Hiding Rows & Columns Hiding Worksheets Hiding & Locking Cells Protecting Workbooks 182 Protecting VBA 207 183 Appl: Electronics Cooling 208 187 Flexibility & Extensibility 209 188 Format for Printing 210 189 Integ with Other Docs 211 191 Strings (Characters) 212 192 Ex 8: System Sheet 213 193 Ex 8: Hints 214 195 196 App A: Upgrading from 197 Excel 2003 215 216 198 Reviving Legacy Files 199 Excel 2007 New Features 217 218 200 Excel Size Limitations 201 Excel 2007 VBA Changes219 220 203 Getting Started 221 204 Command Guide 205 206 excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 29. Table of Contents (cont) (isothermtech.com) App B: Excel 2003 and Earlier Versions Settings - Security ≤2003 Settings – Options ≤2003 Naming Cells ≤2003 Names - Using ≤2003 Analysis ToolPak ≤2003 Sheets & Linking ≤2003 Cell Formatting ≤2003 Equation Object ≤2003 Graphics ≤2003 Graphics ≤2003(cont) Control Toolbox ≤2003 VBA – Accessing ≤2003 Sub Proc’s ≤2003(cont) Recording Macros ≤2003 Recording ≤2003(cont) Help - Excel ≤2003 Curve Fitting ≤2003 © 2014 Matthew E. Moran Curve Fitting ≤2003(cont) 240 Data & Refrs ≤2003(cont) 242 ActiveX Controls ≤2003 244 Buttons ≤2003 245 Cell Validation ≤2003 246 Scenarios – Setup ≤2003 247 Goal Seek ≤2003 248 Customize Look ≤2003 249 Modify Features ≤2003 250 Solver – Initial Use ≤2003 251 Solver - Settings ≤2003 252 Protecting Wrkbks ≤2003 253 Format for Printing ≤2003 254 Format ≤2003 (cont) 255 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 App C: Functions in Excel & 237 Visual Basic 256 238 Excel Fcn Categories 257 239 Functions – Compatibility 258 Functions – Cube Functions – Database Functions – Date & Time Functions – Engineering Functions – Financial Functions – Information Functions – Logical Functions – Lookup &Ref Functions – Math & Trig Functions – Statistical Functions – Text Functions – UDF & Web Functions – VB Conv Functions – VB Math Functions – VB String 260 261 262 264 267 270 271 272 273 277 283 285 286 288 290 Index of Topics Testimonials 292 296 excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 30. (isothermtech.com) Course Description These course notes (available in paperback and kindle formats) are from the 2-day short course entitled “Engineering Analysis & Modeling with Excel-VBA”. In-depth details are presented on principles, practices, and implementation of Excel and its integrated programing language – Visual Basic for Applications (VBA) – for analysis and engineering model creation. The exercise problems in each section build upon the previous exercises to demonstrate new techniques. To obtain completed exercises and other helpful Excel VBA resources, visit: www.isothermtech.com. © 2014 Matthew E. Moran FEEDBACK ON SELF-STUDY USING THE COURSE NOTES "I worked through the course materials of 'Engineering Analysis & Modeling w/Excel/VBA' and would highly recommend it to other engineers.", Maury DuPont, University of Cincinnati "...the exercises were very easy to understand... followed extremely well after the learning slides that came before them. The instructions were detailed enough to understand, but still left enough leeway for individual learning", Monica Guzik, RoseHulman Institute of Technology excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 31. (isothermtech.com) Course Feedback “Great material, great presentation”, William J. Armiger, Naval Research Laboratory “Lots of useful information, and a good combination of lecture and hands-on”, Brent Warner, Goddard Space Flight Center “Excellent course documentation... excellent communicator”, Linda Hornsby, Jacobs ESTS Group “Very knowledgeable... presented clearly and answered all questions”, Marc Wilson, Johns Hopkins University Applied Physics Laboratory “Great detail… informative and responsive to questions. Offered lots of useful info to use beyond the class”, Sheleen Spencer, Naval Research Laboratory “Excellent… Good overview of VBA programming…”, John Yocom, General Dynamics “Really enjoyed how much info was passed along in such a short and easily understandable method”, Will Rehlich, Noren Products “Good introduction and quick functioning using VBA was enabled by this course”, Michael R. Palis, Hybricon Corp. “I’ve been looking for a course like this for years! Matt was very knowledgeable and personable and walked his talk”, James McDonald, Crown Solutions “Gave me a lot to work with. Very helpful and hands on. [My favorite parts?]... It was all good”, Dale Folsom, Battelle “Matt was extremely knowledgeable and a great instructor”, Jennifer Snelling, Barrios Technology © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 32. (isothermtech.com) Course Materials Visit www.isothermtech.com to get a variety of course materials and resources: • Course notes in paperback and kindle formats • Excel files containing worked-out copies of all the course exercises • Helpful reports and online resources • Sample slides and exercises • Training course videos • Upcoming course offerings © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 33. (isothermtech.com) Intended Audience & Usage These course notes are intended for practicing engineers, scientists and others with an interest in analysis and modeling. It is targeted toward intermediate to advanced Excel users, although no prior experience with VBA is assumed. If you are new to Excel, you should consider supplementing these notes with an introductory course or book. You may occasionally hear or read the opinion that Excel is not an appropriate tool for engineers. This is nonsense. The instructor has used many engineering software tools for more than three decades (e.g. general math, finite difference, FEA, CFD, CAE, DAQ, system simulation, custom codes, etc.), and they all have their place. Excel has a rich set of features for calculation, visual display and user interaction that makes it a very good general tool for many engineering and other technical computations. With its built-in VBA programming environment, and the associated techniques taught in these course notes, it becomes a highly versatile platform. Nonetheless, there is no substitute for good professional judgment in choosing the right tool for the job. There are certainly applications where Excel isn’t the best choice or even a viable option in some cases. It’s important to remember that the quality of all analytical results are dependent on a user’s skills, knowledge, experience, discipline, and work quality. Any software tool will provide poor results if used improperly, although some tools hide it better with a polished display! In addition, verification and validation are always critical, and should be part of any analysis or model regardless of the tools and methods used. With that in mind, this course teaches principles and practices with Excel VBA that facilitate quality results. © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 34. (isothermtech.com) How to Use These Course Notes Ways to use the course notes:* • Self study (paperback or kindle versions) • Video training (with paperback or kindle version)** • Course offering (public or hosted)** Each section uses a sequential teaching methodology: 1) Real world application to illustrate the topics to be covered 2) Introduction to the learning topics and step-by-step details on how to implement them in Excel VBA 3) Integrated hands on exercise to solidify the topics learned General format & conventions: • Screen shots are predominantly used to facilitate immediate experimentation and rapid learning • Notes, tips, and step-by-step instructions throughout • Detailed text limited to topics needing more explanation • Valuable supplemental info included in the appendices * Visit www.isothermtech.com for information on video training and upcoming courses ** Video & course offerings can be applied toward PE continuing education requirements (check with your state or other licensing entity to confirm what types of training qualify) © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 35. Instructor Bio (isothermtech.com) (Dec, 2013) Matt Moran is the owner of Isotherm Technologies LLC. He is also a sector manager and senior engineer at NASA. Matt teaches engineering analysis seminars throughout the U.S., and has been adjunct faculty at the graduate school at Walsh University and other colleges. He has been a co-founder or key contributor to the start up of five high tech businesses, and has worked with hundreds of organizations of varying size, type and industry sector. Matt has 32 years experience developing products and systems for aerospace, electronics, military, and power generation applications. He has used many software tools for analysis and modeling. Matt has created Excel VBA engineering system models for DARPA, Air Force, Office of Naval Research, Missile Defense Agency, NASA and various commercial organizations. Matt is a Professional Engineer (Ohio), with a B.S. & graduate work in Mechanical Engineering, and an MBA in Systems Management. He has published 44 papers and a book; and has 3 US patents. © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 36. (isothermtech.com) Course Summary This course will provide the knowledge and methods to create custom engineering models for…  Analyzing conceptual designs  Creating system trades  Simulating operation  Optimizing performance …with Excel VBA. The instructor has been using spreadsheets for engineering computations since the early 1980s; and VBA since 1996 (shortly after its integration with Excel). He has taught these methods to hundreds of course participants since 2007. © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 37. (isothermtech.com) Learning Objectives • Exploit the full power of Excel for building engineering models • Master the built-in VBA programming language • Implement advanced data I/O, manipulation, analysis, and display • Create full featured graphical interfaces and interactive content • Optimize performance for multiparameter systems and designs • Integrate interdisciplinary capabilities into engineering models © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 38. (isothermtech.com) Topics: Design & Build 1. 2. 3. 4. 5. Excel VBA Review Identifying Scope & Capabilities Quick Prototyping Defining Model Structure Designing Graphical User Interfaces 6. Building & Tuning the VBA Engine 7. Customizing Output Results 8. Exploiting Built-in Excel Functions © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes
  • 39. (isothermtech.com) Topics: Refine & Optimize 9. Integrating External Data 10. Adding Interdisciplinary Capabilities 11. Unleashing GoalSeek & Solver 12. Incorporating Scenarios 13. Documentation, References, & Links 14. Formatting & Protection 15. Flexibility, Standardization, & Configuration Control 16. Other Useful Tips & Tricks 17. Application Topics © 2014 Matthew E. Moran excerpts from: Engineering Analysis & Modeling with Excel-VBA: Course Notes