48221 Lecture Notes - Lecture 3: Boiling Point, Inverse Trigonometric Functions
Tutorial 3 Problem 2 Code VBA:
Public Function Vol_Sphere(r)
'UDF note: name of funciton should be inconspicuous
'ALWAYS HAS AN INPUT INSIDE BRACKETS
'input is r, the radius
'V=4/3*pi*r^3
'setp 1: inputs, pi= Arctan(1)
Pi = 4 * Atn(1)
'= means "gets"
'calculation
volume = 4 / 3 * Pi * r ^ 3
'output
'a functions output always starts w name of function
'in this case, Vol_sphere
Vol_Sphere = Round(volume, 2)
End Function
Public Function F2C(f)
'inputs
'Calculation
TemperatureC = (f - 32) / 1.8
'output
F2C = TemperatureC
End Function
Public Sub Shpere_vol_sub()
'sub procedure w no inputs in the brackets
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
"udf note: name of funciton should be inconspicuous. "calculation volume = 4 / 3 * pi * r ^ 3. "a functions output always starts w name of function. "sub procedure w no inputs in the brackets. "dont have to put outputs w procedure name. "aka a macro that needs a button to run. "need to specify where the input is on spreadsheet aka what cell r = range("a8"). value. "calculations (one for volume) vol = 4 / 3 * pi * r ^ 3. "calculations, tc and comments tc = (tf - 32) / 1. 8. If tc >= 100 then comm = "above boiling point of water" Elseif tc = 37 then "needs to be dimmed as an integer to work comm = "human body temperature" "need to do in the right order to assign correct comment to temp. Elseif tc = -40 then comm = "equivalency temperature" Elseif tc <= 0 then comm = "below freezing poing of water"