Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1-Macros in Excel
2-User defined functions
3-Controls from form Toolbar
4-User form and controls
5-VBA (Visual Basic for Applications)
Macros in Excel
1-Macros in Excel
Record a macro
Macros in Excel
Record a macro
Macros in Excel
Record a macro
Macros in Excel
Record a macro
Macros in Excel
Macros in Excel
Macros in Excel
Macros in Excel
11
10
Macros in Excel
12
Macros in Excel
13
Macros in Excel
14
Form controls
Form controls
You can create scroll bar, list_box,
combo_box and others on Excel
sheet using the form controls
15
16
Form controls
Form controls
Group box
Command
button
Combo Box
List Box
Check
Box
Scroll Bar
Option button
Excel for Engineers-part2
17
Form controls
18
Form controls
19
20
Form controls
21
22
InputBox Function
InputBox Function
Syntax
InputBox(prompt[, title] [, default] [, xpos] [, ypos] [, helpfile, context])
23
24
Input Box
Massage Box
Syntax
MsgBox(prompt[, buttons] [, title] [, helpfile, context])
25
26
27
28
29
30
y = a0 + a1 x + a2 x 2
Function myfun(x)
a0=5
a1=0.5
a2=0.75
myfun=a0+a1*x+a2*x^2
End function
Now you can go to the excel sheet and type =myfun(1) the
answer will be 6.25
Excel for Engineers-part2
31
32
33
34
2-if you start the first line with single quote or the
word rem, then that statement is a remark
statement
35
36
37
38
10
39
40
42
11
43
44
1- Table interpolation
1- Table interpolation
Program name:
table interpolation.xls
45
1- Table interpolation
12
46
1- Table interpolation
47
48
1- Table interpolation
Air properties
Cp_air(T)
Prandtl_air(T)
Density_air(T)
Conductivity_air(T)
Water properties
Cp_water(T)
Prandtl_water(T)
Spvolliq_water(T)
Conductivity_water(T)
Excel for Engineers-part2
49
Turbulent
flow
f =
Re<2300
Re>=2300
1
f
0. 5
64
Re
e / D
2.51
= 2.0 log
+
0.5
3.7 Re f
13
50
Laminar
flow
51
52
53
54
h
W
Ws
f
For example
Ws
W
t.
sa
dry temp.
14
humidity ratio
55
td
56
W = 0.622 Pv
P - Pv
*
W=
Ws ( 2501 - 2.326 t * ) - (t - t * )
(2501 + 1.86 t - 4.186 t * )
Pvs ( t d ) =
WP
0.622 + W
= Pv
Pvs
57
58
15
59
60
CP
P2 > P1
P1
Sub-cooled region
Sub-cooled region
Saturated region
Saturation region
Superheated region
61
16
62
63
64
1 bar=100 kPa
Excel for Engineers-part2
65
66
1-Enthalpy h: h_pt(P,T)
2-Entropy s: s_pt(P,T)
17
67
68
69
Insertion of a form
ComboBox
Command
button
Forms, user
form1
Tools
Label
Toolbox for
Controls
Text Box
Properties window
Userform
18
70
71
Properties
window
Userform
frame
72
19
73
74
75
76
77
78
Summary
Conclusions & Recommendations
4-Macros in Excel
5-Forms toolbox
20
79
80
81
82
21
83
84