You are on page 1of 12

PREPARED BY:

DIPESHKUMAR.U. PURI
Roll no :- 829
GUIDE:
Ms BHUMIKA RANA


The Maharaja Sayajirao University of Baroda
Faculty Of Technology and Engineering
Introduction
A computer can help us to solve problems, especially which require a large number of
iterative calculations.
Excel is a commonly used and easily available office software.
We can make use of the Excel VBA to solve numerical problems in Chemical
Engineering
How to make use Excel VBA to solve chemical engineering problems?
Fundamental VBA syntax.
How to analyze and covert a chemical engineering problem into an Excel VBA
program

Content
Introduction to Different Calculations in ChE.
Why Excel VBA Programming is needed?
Chemical Engineering Problem Solving using User Defined
Functions in Excel.

Types of ChE calculations carried out using Excel


o General, small-scale, day-to-day calculations
formula-based calculations
data manipulation, graphics & statistics
what-if scenarios and case studies
o Flowsheet calculations
material & energy balances
vapor-liquid equilibrium, chemical equilibrium
reaction kinetics, detailed design of process equipment
o Financial calculations
project economics
profit/cost optimization
Fact: The spreadsheet program, and primarily Microsoft Excel, is the most
common computing tool used by the practicing chemical engineer.
Working with the Visual Basic Editor
Project
Explorer
Properties
window
Code
Window
Function
Name
Function
Body
Visual Basic for Applications
o VBA a significant subset of the stand-alone Visual Basic programming language.
o It is the macro language of Excel.
o You can add
o Forms for dialog boxes with user input
o Classes for object definitions
o Modules containing procedures
o You can compose your own Macro commands that instruct Excel to do repeating
jobs.
o We can make use of the Excel VBA to solve numerical problems in Chemical
Engineering
Creating a function
Suppose we want to create an Excel
function that takes a temperature in
Celsius and converts to Fahrenheit
We would type the following in
a module:
Function ctof(temp)
ctof = 9 / 5 * temp + 32
End Function

ctof depicts
Degree Celsius to
Degree Fahrenheit

Should Be same as
the Function Name

Formula

Checking the User Defined Function
Drag
Coefficient
Checking the User Defined Function
Antoine
Coefficient
Function Modules
Example
Functions in
VBA (MS-Excel)
Function NPr(Cp, vis, K)
NPr = ((Cp * vis) / K)
'Cp=Heat capacity in Kg/(Kg.K)
'K=Thermal conductivity in w/(m.K)
End Function
Comments Always
In the code window
inside Single quote
on one side.
Function NPr(Cp, vis, K)
NPr = ((Cp * vis) / K)
Flaw: Vba doesn't support
Symbols,thus one needs to
define names to symbols.
'Cp=Heat capacity in Kg/(Kg.K)

Comment is necessary In order to depict
what are the letters used for.
THANK YOU
An Example to support the use Excel in chemical
engineering.
A simple example to understand how VBA
works in MS-excel. VBA Interfaces.

You might also like