This document provides an overview of Excel Visual Basic for Applications (VBA). It begins with an introduction to VBA and its uses. It then discusses how to record macros to automate repetitive tasks in Excel. The document explains the differences between subroutines and functions in VBA. It also provides instructions for using the Goal Seek and Solver tools in Excel for modeling and optimization. The document concludes by offering to answer any questions.
2. HELLO!
I am Dhruyen Hadiya
I am here to give presentations
on topic Excel-VBA.
Subject: Process Modelling, Simulation
and Optimization(3170513)
3. Table of Contents
Visual Basic for
Applications
Finding the correct input
when only the output is
known
An action or a set of actions
that you can record
Use for what-if analysis
MACRO SOLVER
VBA GOAL SEEK
4. “ VBA stands for Visual Basic for
Applications. Excel VBA is Microsoft's
programming language for Excel.
Excel analysis is ubiquitous around the
world and used by businesses,
chemical & biomedical engineering of
all sizes to perform analysis.”
5. While we cannot directly manipulate
the main Excel software through
VBA, we can, however, master the art
of making MACROS to optimize our
time in Excel.
If you have tasks in Microsoft Excel that
you do repeatedly, you can record a
macro to automate those tasks.
6. ● In the Code group on the Developer tab, click Record Macro.
● Optionally, enter a name for the macro in the Macro name box, enter a
shortcut key in the Shortcut key box, and a description in the Description box,
and then click OK to start recording.
● Perform the actions you want to automate, such as entering boilerplate text or
filling down a column of data.
● On the Developer tab, click Stop Recording.
How to record
MACRO?
7. SUBROUTINE FUNCTION
A Subroutine in VBA is a piece of
code that performs a specific task
described in the code but does not
return a result or a value.
Subroutines are used to break down
large pieces of code into small
manageable parts. Subroutines can
be recalled multiple times from
anywhere in the program
A function performs a calculation
and returns a single value. The SUM
function adds the sum of a range of
values.
8.
9. GOAL
SEEK
The Goal Seek Excel function (often
referred to as What-if-Analysis) is a
method of solving for a desired output
by changing an assumption that drives
it. The function essentially uses a trial
and error approach to back-solving the
problem by plugging in guesses until it
arrives at the answer.
10. STEP FOR GOAL SEEK
● Create a spreadsheet in Excel that has your data.
● Click the cell you want to change. This is called the “Set cell.”
● From the Data tab, select the What if Analysis… button.
● Select Goal seek… from the drop-down menu.
● In the Goal Seek dialog, enter the new “what if” amount in the To value:
text box.
● We also need to tell Excel which cell to change.
● Click OK. Excel will overwrite the previous cell value with the new one.
13. Solver is a Microsoft Excel add-in program you can use for what-if
analysis. Use Solver to find an optimal (maximum or minimum)
value for a formula in one cell — called the objective cell — subject
to constraints, or limits, on the values of other formula cells on a
worksheet.