Sunteți pe pagina 1din 9

DEVELOPMENT OF PACKAGES FOR ANALYSIS AND DESIGN OF

CIVIL ENGINEERING STRUCTURES WHICH EXTENSIVELY


UTILIZES MS EXCEL

P.C.VASANI
Assistant professor
Applied mechanics department
L.D.College of Engineering
Gujarat University
Ahmedabad-380015
(INDIA)

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

DEVELOPMENT OF PACKAGES FOR ANALYSIS AND DESIGN OF


CIVIL ENGINEERING STRUCTURES WHICH EXTENSIVELY
UTILIZES MS EXCEL
1 INTRODUCTION
1.1 GENERAL:
The useful work is a development of package for analysis and design of civil engineering
structures which extensively utilizes MS EXCEL environment and Visual Basic for
Application as supporting programming language. Moreover the results may be
graphically interpreted in most powerful drafting tool available therein as AUTOCAD.
1.2 BRIEF HISTORY OF SPREADSHEET
Spreadsheet were developed to include business application, mathematical
calculations, accounts and database management. In the beginning, with help of
calculations people found it difficult to perform lengthy calculations so thus gave birth to
most primary type spreadsheet, visicalc which had undergone series of change by
different companies and ultimately resulted into supercalc. But this had many limitations
and therefore subsequently new product called LOTUS 1-2-3 was released which met
with great success and dominated for a long period of time. It incorporated powerful
electronic spreadsheet, graphics, database features. The lotus 1-2-3 had edge over other
similar spreadsheet of Borland. Subsequently new versions were added.
Microsoft release of Windows changed the way people used personal computer.
Lotus was slow getting out of the gate with its first window spreadsheet. Later on with
improvement in existing facilities Excel merged out with overwhelming success in
window based spreadsheet application and became market leader. Excel got on adding
more versions like Excel - 2.0, 3.0, 2.21, 4, 5 and 7 and Excel 97 and so on.
2. EXCEL AND ITS EXCELLENT FEATURES
Excel the Microsoft product has gained great importance owing to spreadsheet
based application. It has high programming facility which can do everything very basic to
memory allocations, matrix application and self recording of each step performed by the
user.

2.1 EXCEL KEY FEATURES:

File structure: Multisheet orientation make it organize elements of application


and store it in single file. Single workbook can hold numbers of worksheets, charts
sheets, and VBA modules.

Visual basic application: The new macro language lets one create structured
programs directly in excel.

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

Dialog box controls directly on worksheet : Excel makes easy to add controls
such as buttons ,list boxes , and option lists to a worksheets requiring little or no
programming.

Custom dialog boxes: One can easily create professional - looking dialog box.

Customizable menus: One can change menu , add to existing menus , or create
entirely new menus.

Customizable Toolbars: It is easy to create new tool-bars as another user


interface option

Customizable short cut menus: Excel is only spreadsheet that lets one customize
the right click, context -sensitive short cut menus.

Slide shows: Create self-running presentation, using text, Charts, pictures and
even sound.

Microsoft Query: One can access important data in standard database file
formats directly from the spreadsheet environment.

Extensive protection option: Application can be kept confidential and protected


for changes.

Ability to create compiled add-ins : With single command, one can create
uneditable XLA add in files that attach seamlessly.

Customs worksheets functions: Using VBA one can create custom worksheet
functions to simplify formulas and calculations.

2.2 EXCEL AND ITS CONTENTS: Excel elements has object hierarchy. It is clearly
understood that each element of EXCEL can be sub-divided into smaller elements which
is referred as object. EXCEL is a main object. Following are further division of workbook
object.

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

EXCEL

WORKBOOK

WORKSHEETS: It has many columns and

CHARTSHEETS: This includes Graphics,Drawing imported


from

Autocad files,Power-point etc.


XLM MACRO SHEET: It is XLM macro sheet (MS Excel
macro sheet) is essentially a worksheet. An XLM macro sheet
display formulas rather than result of formulas. XLM macro
sheet is designed to XLM macro. It is included from previous
versions.
VBA MODULE : It resembles like word processor document.
It incorporates visual basic code, grouped in subroutine
and functions. It can hold 4000 lines of code.
DIALOG SHEETS: Dialogsheets holds a single custom dialog
box which is one of the user interface drawing components. A
workbook can hold as many 256 dialog sheets.
DRAWING OBJECTS: It consists of lines, rectangles, circles,
arcs, rectangles, square, buttons, colours and free-hand drawing
objects.

2.3 OVERVIEW OF EXCEL MAIN SCREEN:


1.

Standard

Issuing commonly used commands.

2.

Formatting

Changing how your worksheets looks.

3.

Query and Pivot

Working with external database and pivot tables.

4.

Chart

Manipulating charts

5.

Drawing

Adding drawings and diagrams to worksheets or charts

6.

Tipwizard

Displaying helpful tips.

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

7.

Forms

Creating custom dialog boxes and adding controls to


worksheets

8.

Stop recording

Ending macro recording

9.

Visual Basic

10.

Auditing

Identifying errors in your worksheet

11.

Workgroup

Interacting with other ones

12.

Microsoft Query

Quickly landing or switch to another Microsoft

13.

Full screen

Switching out of full screen

Writing macros in visual basic application

2.4 MORE ABOUT WORKSHEET


Worksheet can have a data as Value, Text and formulas. Many formats can be
applied to above data like fonts for text, style of numbers, borders can be applied to above
data type, One can add a worksheet, delete a worksheet, rename a worksheet, move or
copy a worksheet. At a time number of worksheet can be assembled. One can link a sheet
with other worksheet. Worksheet can be viewed into multiple parts, by splitting panes.
Many worksheet can be viewed simultaneously. In a worksheet rows can be added and
deleted. A particular cell or group of cells (intersection of row and columns) can be
named conventionally as A11, A12,A13, B12,C23.
Certain cell notes can be prepared so as to understand what are the contents
actually mean. A dependence or precedence of cell can be traced out. Besides these
Engineering and Mathematical formulas involving large terms can be solved easily. All
decisions in Business field, predication of any result in coming period, seeking any target
result by simply modifying the dependents and graphical charts are of immense value
which is available in this package.
2.5 EXECUTING A FORMULA
Each formula starts with = sign then followed by a mathematical operands
- , * , + .
If A x B is expressed as = A * B. Above expression is written in cell.
Similarly rounding up of figure can be expressed as =Roundup(23.567,0) results
to 23.57. Similarly =ROUNDDOWN(34.56,-1) results 34.50
MAX. , MIN. , to find out maximum , minimum values from set of numbers.
VLOOKUP to interpolate for a given value from set of values.
2.6 EXECUTING A PROGRAM: (VISUAL BASIC FOR APPLICATIONS)

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

VBA is based on Microsoft Visual basic programming system (VB.) it is


relatively easy programming language that lets developers create stand-alone Window
application.
Macros which is command language in Lotus and other versions are keystrokes which
when exceeded performs the required task. While as macros for Excel version 5 is written
in VB. code. They are written in module which is similar to text editor. Several modules
can be created in Excel.
2.6.1 DIFFERENCE BETWEEN VBA AND VB. :

VBA does not support custom controls, stored in VBX files. VB. users thrive on
these files, which add lots of new features.

Each VB applications has its own forms design capabilities. The way one designs
form (dialog box) in EXCEL is different from the method used in Project. Both
methods are very different from the way its done in VB.

VBA does not support nearly as many events as VB. In VB., one can attach code
to several events (Button click, Button double click, Button right click,and so on.)

VBA offers two new syntax constructs. In VBA, one can use the For Each.... Next
Control structure for looping through collections (which are essentially groups of
like objects), and With...End With construct for abbreviating object references.
These are not available in VB. Here VBA code can manipulate with all objects of
windows for looping purpose with (For Each Next) and condition statements
with (With End).
Example for each next is as follows;
For each win in Windows
If win.Caption = Bubble chart help Then
Windows ( Bubble chart help).activate
Exit sub
End if
Next win

Example for with end is as follows;


With active window
.Caption = Bubble chart help
.Width = 350
Height = 250
End with
VBA, as it is implemented in EXCEL 5 and Microsoft Project, provides access to
collections. VB does not offer this.
One cannot create stand-alone EXE files using VBA. All VBA applications require
the host application. If one creates a VBA application in excel, the end user of the
application must have a copy of Excel in order to use it. Excel, in such a case,

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

serves as sort of an object library which must be available in order for the
application to run.

VBA offers a line continuation character (a space followed by an underscore).VB


doesnt have this feature.
2.6.2 VBA LANGUAGE ELEMENTS: VBA requires three basic elements
Subroutine procedures: A subroutine is a set of instructions that performs somber
action.
Function procedures: A function is set of information that returns single value.
Declarations: A declarations is statement of information that one provides to
VBA.
Generally all actions for programming are written (or recording ) code in a VBA
module sheet. VBA module are stored in an Excel workbook, and a workbook can
hold any number of VBA modules.
A VBA module consists of subroutine procedures. A subroutine procedure is
basically computer code that performs some action on or with objects.
A simple example is as follows:
Sub Myage()
age = 23
Msgbox My age is & age
End Sub
A VBA module can also have function procedures. A function procedures returns
single value. A function can be called from another VBA procedure, or even used
in a worksheet formula. For e.g.:
Function rv(tplate,type)
shear = 3.14 / 4 * (d) * 100
If type = 1 then
shear = 1 * shear
End if
If type = 2 then
shear = 2 * shear
End if
rv = shear
End function
VBA manipulates objects. Excel provides one with 128 objects to manipulate.
Examples of objects include a workbook, a worksheet, a range on a worksheet, a
chart, and a drawn rectangle. Many, more objects are at ones disposal, and one can
manipulate them using VBA code. Objects are arranged in hierarchy. Object can act
as containers for other objects. For e.g. Excel is an object called Application, and it
contains other objects such as Workbook and Toolbar objects. The workbook
object can contain other objects such as worksheet objects and Chart objects. A

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

worksheet object can contain objects such as range objects, pivot table objects, and
so on. The arrangement is referred as object model. Like objects form a collection.
For example the worksheet collection consists of all the worksheets in a particular
workbook. The toolbars collection consists of all Toolbar objects. Collections are
objects in themselves. One can refer to an object by specifying its position in the
hierarchy, using a period a separator.
For e.g. workbook can be referred as:Application. Workbooks( Book1 )
This refers to Book1.xls workbook in the workbooks collection is contained in the
application object (that is Excel). Extending this to another level, one can refer to
Sheet1 in Book1 as
Application.Workbooks( Book1 ).worksheets( sheet1 )
One can take it to still another level, and can refer to specific cell as follows:
Application.Workbooks( Book1 ).worksheets( sheet1 ).Range( A1 )
If Book1 is a active workbook, the previous reference can be simplified as
Worksheet( sheet1 ).Range( A1 ). If sheet is active then simply Range(
A1 ).
Object has properties. Range object has properties such as name and value. The
range object can be referred by above property. Suppose a value of a cell is to be
ascertained then can be written as
Worksheets( sheet1 ).Range( A1).Value
Object has methods. Methods can be associated as :Worksheets( sheet1 ).Range( A1 ).Clearcontents.
VBA also supports modern programming languages including arrays, looping ,
and so on.
VBA supports data types for variables such as Boolean, Integer, Long, Single,
Double, Date, String, Object, Variant and user defined.
Dim x as Integer, Dim y as Long ,Dim xyz as Single, Dim abc as Date ,Dim name
as string*20. Dim array size (1 to 20) as single
Besides these user-defined which is similar to C - structures.
2.6.3 PROGRAMMING MODE SUPPORTED BY VBA :
1) GOTO STATEMENTS: This is to continue a process or to skip a
process according to the condition required.
For example
If X > Y GOTO LAST
Msg Box OK
End if
LAST:

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

Msg Box NOT OK


2) IF THEN: This is to check whether statement is True or False and
executes accordingly.
For example
If Shear > = 87
Then
Msg Box Shear Check Not OK
End If
If Shear < 87
Then
Msg Box Shear Check OK
End If
3) SELECT CASE: This is to select a statement according to the value of
variable
For example
t = Input Box ( Give thickness, VBOK, Input thickness)
Select Case t
Case 1: statements
Case 2: statements
Case 3: statements
End Select
4) CALLING SUBROUTINE & FUNCTION: This is to call a sub routine
or function in the same module or different. It is called by Call Curtail.
Here curtail is a sub routine called by main programme. Function can be
called as RV(tplate,ty) here RV(tplate,ty) is a sub routine and tplate, ty
are arguments.
5) LOGICAL OPERATORS (AND OR): They are conditional statements
like AND and OR. AND is used when both variables result is true. OR is
used when either of the variables is true.
Declarations of various types of subroutines and function are as under:
Public Subroutine: They can be called by other subroutines in any module.
Private Subroutine: They can be called by other subroutines in the same module but
not by subroutine in other module.

:REFERENCES:
1)

Mastering Excel for Windows THOMAS CHESTER.

2)

Excel for Windows Power programming technique JOHN WELENCHBACK.

PDF created with FinePrint pdfFactory trial version http://www.fineprint.com

S-ar putea să vă placă și