In this third and final installment of the popular VBA and Excel for Engineers and Scientists series, we will look at one of the most important techniques for extending Excel with VBA, the Range Object. I’ll show you the best way to refer to single cells, multiple cells, how to get values from them and put values back into ranges using the VBA. And we’ll program up a simple Monte Carlo Simulation example and lastly we’ll look at how to read and write to text files and to manipulate files and folders in Windows.
My apologies to anyone in the past two months who tried to download my sample Excel spreadsheet that went along with the article " VBA and Excel for Engineers and Scientists â€“ Part 2". I didn’t notice that there was a problem with the download until a new member emailed me about it (thanks Chris). I believe that it’s working now, if not be sure to email me! By the way, I’ve been out in the field since last week, sorry for the sparse posts.
Download the GeoPrac-VBA2-Examples.xls Spreadsheet (Excel 97-2003 format, but works with 2007 also)
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.
Visual Basic for Applications or VBA used in conjunction with Microsoft Excel is a tool that many scientists and engineers have yet to take full advantage of. This article is the first in a series designed to provide you with the basic understanding of how to use VBA and Excel in your practice.