Member Login

Login
No account yet? Register
 

Search GeoPrac

Site Sponsors

Even More News and Blog Posts!

New on GeoPrac.net, the Other News and Blogs page has had a major facelift. To supplement our regular GeoNews and Articles, we aggregate news feeds and blog entries from all over the web into one easy to browse source. Check it out!  

Become an Author

GeoPrac.net is a community site, we are only as good as the content our members contribute!

Whether it's a one time contribution, or a monthly or quarterly article, please consider becoming an author

Subscribe by Email

Subscribe to GeoPrac.net Headlines by Email. Powered by FeedBurner.com, Don't forget to follow instructions to verify your subscription!

Enter your email address:

RSS Feeds

To subscribe to GeoPrac.net headlines, use one of the buttons below. Or view other available feeds or read more about RSS.

Home arrow Articles arrow Browse by Category arrow Software and Spreadsheets arrow VBA and Excel for Engineers and Scientists – Part 2
VBA and Excel for Engineers and Scientists – Part 2 - Introduction Print E-mail
Written by Randy Post   
Tuesday, 20 May 2008
Article Index
Introduction
Code Containers
Subroutiness and Functions
Variables and Data Types
Declaring Your Variables
Variable Expressions and Math
Other Functions
Flow Control
Help and Debugging
Custom Spreadsheet Functions
Examples and Downloads
Wrap-up and Recommended Books
Digg!Reddit!
Del.icio.us!Google!
Facebook!Slashdot!
Technorati!StumbleUpon!
Newsvine!Furl!
Yahoo!Ma.gnolia!

Microsoft Excel and Visual Basic for Applications or VBA make a powerful combination and a useful tool for scientists and engineers. In the first article in this series, I attempted to give you a basic understanding of VBA and an introduction to the Visual Basic Editor or VBE environment. We also produced our first code (the obligatory "Hello World"). In this long awaited second article in the series, I will dive into the meat of the VBA programming language, including code containers, data types, variables, math operators, built-in functions, flow control, and even debugging.. In the end, you should be able to code some fairly complex things including custom worksheet functions that you can use in your spreadsheet just like a regular formula. Also in this article I give you a sample spreadsheet with some useful utilities that you can use right away. One that is particularly useful is a general interpolate/extrapolate function. Enjoy!

VBA and Excel for Engineers and Scientists – Part 2

By Randy Post, P.E., G.I.T.
Editor, GeoPrac.net

Introduction

In the 1st installment in my series on VBA and Excel for Engineers and Scientists, I provided an overview of the benefits of developing spreadsheet applications in VBA and Excel. I also discussed other programs that use VBA, introduced you to the Macro Toolbar and Macro Menu, and the Visual Basic Editor (VBE) and you wrote your first program, the obligatory “Hello World”.

In this article, I hope to provide you with a crash course in the programming language basics so we can move on to solving some problems that are a little more interesting and practical to an engineer or geologist! In the first few sections I’ll cover various types of containers for your code, Subroutines vs. Functions, variables and data types, functions, and math operators and functions. Then in the last section or two, we will look at creating your own excel functions. I’ll even give you some free VBA code for easily performing linear interpolation and extrapolation. Let’s get to it!

Note: Most of this article was written with Excel 2003 in mind, but I have since started using Excel 2007. I have found that there are no really significant changes to the way VBA operates in 2007 so the content of this article should work for either version. If I’m wrong, let me know! I have also developed for Excel 2000 and even Excel 97, and the topics covered should be relevant to those versions as well.



Trackback(0)
Comments (1)add comment

Ted said:

 
Very nice. I have avoided vba and macros up to this point but I think I'll give it a try.
Monday June 16, 2008 10:13AM

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley

security image
Write the displayed characters


busy
Last Updated ( Monday, 21 July 2008 )
 
< Prev   Next >

Site Sponsors

Users Online

No Users Online

Statistics

Members: 102
News: 353
Web Links: 113

GeoPrac.net © 2007 Randy Post unless noted.
Terms of Use | Copyright Info | Privacy Policy | Disclaimer | Sitemap

Other Randy Post Sites: RnRPost.com | NameDrawing.net 

Article Copyright

All content in the ARTICLES section of GeoPrac.net is copyrighted by their authors unless otherwise noted and reproduced here with permission. Refer to the copyright page or the terms of use for more information.