Test Your Excel VBA Skills: 8 Engineering Exercises

()

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:



? 2014 Matthew E. Moran

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

()

Exercise 1: Convection Sheet

(To obtain completed exercises, an electronic version of the notes,

and other helpful Excel-VBA resources, visit: )

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

()

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:

¨C Fraction notation

¨C Subscript & superscripts

? 2014 Matthew E. Moran

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

()

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

()

Exercise

2:

Convection

VBA

Hints

(To obtain completed exercises, an electronic version of the notes,

and other helpful Excel-VBA resources, visit: )

? 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

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download