using excel_ nomenclature, macro and tips
DESCRIPTION
VBA ExcelTRANSCRIPT
-
6/1/2015 UsingExcel:Nomenclature,macroandtips
http://books.ifpenergiesnouvelles.fr/ebooks/thermodynamics/help/help.html 1/2
HOME CONTACTUS
Download
Chapters
Casesstudies
Chapter1:
titleAbstract Tableofcontents Examples
Chapter2:
FromFundamentaltoPropertiesAbstract Tableofcontents Examples
Chapter3:
titleAbstract Tableofcontents Examples
Chapter4:
titleAbstract Tableofcontents Examples
Chapter5:
titleAbstract Tableofcontents Examples
Chapter6:
titleAbstract Tableofcontents Examples
Chapter7:
ThreephasesreactionsinClausstailgastreatment(CLAUSPOL)
Chapter10:
ComplexpolarmoleculardescriptionforhighdilutionVLEseparation(ESTERFIPH)
SelectthermodynamicmodelsforprocesssimulationAPracticalGuidetoaThreeStepsMethodology
UsingExcel:Nomenclature,macroandtips
Nomenclature
Ineachfileassociatedtoalltheexamplesofthebook,asimplecolourcodehasbeenusedtohelpusertodifferentiatedataandresults.Thefilesarenotblocked,norpasswordprotected,soallcellscanbechanged.Nevertheless,onlysomecellsareusedasinputcellstomakeallcalculations.Theinputcellsarewritteninblueandthecalculatedcellsinblack.
Othercellsareusedtoconductiterativeproceduretoreachaspecificresultoroptimizeaspecificobjectivefunction.Inthiscase,thechangingcell iswritteninred,whiletheresultingcell iswritteninbrown. Inmostof thecases,anarrowwillbeplacedinbetweencellstoshowtherelationshipfrominputtooutput.
Macro
Most of calculations in all the examples use macro commands. This technique is helpful and powerful. Reading of the
worksheetisclearerandeditioniseasier.Supposeyouwanttocalculatey=ax2+b.Thecommontechniqueistodefineaandbintwocell,sayC3=aandD3=b.Inothercellyougivethevalueofx,sayE5=x,thenyoucancalculatethevalueofyincellE6as=C3*E5*E5+D3.
YoucandothesamecreatingaMacro(menuTools>Macro>VisualBasicEditor)andwritingasmallfunctioninaModule.Ourcorrespondingexamplewillbe:
PublicFunctionMySample(xAsDouble,aAsDouble,bAsDouble)AsDoubleMySample=a*x*x+b
EndFunction
Intheworksheet,thecalculationcanbemade,forexampleincellE7writing
=MySample(E5,C3,D3).
An important featureofmacrocommands is the fact thatyoucanmakeacomplexcalculationusing logical tools.Averysimpleexamplecanbeconstructedcalculatingthefunctionsin(x)/x.Thisequationcannotbecalculatednumericallyinx=0,neverthelessitiswellknownthattheresulttendsto1.Thispropertycanbeusedinourfunction:
PublicFunctionSinx_x(xAsDouble)AsDoubleIfx=0Then