IP2 Update, ByRef and ByVal

A recent comment pointed out that the IPPlaneLine function (intersection of a 3D line with a plane) in the IP2 spreadsheet was giving incorrect results.  This has now been fixed, and the corrected spreadsheet can be downloaded from IP2.zip.

The problem turned out to be in another function called PlaneCoeff which modified an array that had been passed by reference (ByRef), and this modified array was then used in IPPlaneLine, whereas the unmodified array was required.  The solution was to pass the array by value (ByVal), so that the modifications performed in PlaneCoeff were not passed back to the calling routine.

See  for more details about the effects of passing ByRef or ByVal.

This entry was posted in Arrays, Coordinate Geometry, Excel, Newton, UDFs, VBA and tagged , , , , , . Bookmark the permalink.

1 Response to IP2 Update, ByRef and ByVal

  1. Pingback: 4 Year Report | Newton Excel Bach, not (just) an Excel Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.