VBA and Excel for Engineers and Scientists – Part 2

More Examples and Useful Downloads

Now here is your reward for sticking it out and making it this far. If you haven’t downloaded it already, the GeoPrac-VBA2-Examples.xls spreadsheet has a few more custom spreadsheet function examples. One function pads a number with zeroes (ie. 5 goes to 0005 etc.). Another extremely powerful function can interpolate or extrapolate Y given X and a series of XY data where X is always increasing. To see what I mean, check out a screenshot from the spreadsheet below.

Figure 4: Interpolate/Extrapolate Function in Action

One other bonus in the VBA Article 2 Example file is that I have a module called "modMath2″ which has a bunch of missing trigonometric functions and a few other nice functions, like one that calculates factorials, and a function that returns a random pick from a standard normal distribution, which will help us in the third installment of this tutorial series when we look at performing Monte Carlo simulations.

Download the GeoPrac-VBA2-Examples.xls Spreadsheet (Excel 97-2003 format, but works with 2007 also)

1 Comment

  1. Very nice. I have avoided vba and macros up to this point but I think I’ll give it a try.

Comments are closed.