In microsoft visual basic (using excel), i have a subprogram which, along with a bunch of other things, calculates the area of something. I have also written a function which has a formula in it, but the function relies on the area calculated in my sub to work but i don't know how to let the function refer to that area, it just says the variable is undefined. I do not want to set it as a global variable, i think i need to use ByVal but i dont really have any idea what that means.