Here is a snippet of what I am trying, with no results so far (no errors
either), but that could be because I haven't yet translated all of the rest
of the code:
Function BearingOutputs() As Double
Worksheets("Outputs").Range("Theta").Value = theta_eff
Worksheets("Outputs").Range("EccentricityRatio").Value = ecc
Worksheets("Outputs").Range("AttitudeAngle").Value = att
Where Outputs is the name of the Excel worksheet tab within the file (should
it be the filename, instead?). Do I have to place anything else in the
function call?
Also, do I have to do anything to the Theta Excel cell in order to make it
take the sent variable value?
If this is a function called from a cell on a worksheet, then this won't work.
UDFs called from a cell in a worksheet can only return a value to the cell that
contains that function (with minor exceptions).
If this is called by a subroutine, then maybe the variables don't have anything
in them (yet). I don't see how they were declared and how they were populated.
There are two sheets
One worksheet has several cell values that the user inputs.
Then a function takes those inputed values, makes calculations, and spits
out the variables I have been talking about into a second sheet of cells.
(These variables have been predefined Public prior to the functions in the VB
module.)
You may be able to use a worksheet_change event that runs each time one of those
input cells is changed by the user.
But personally, I think I'd allow the user to enter all the data (and double
check it!), then click a button from the forms toolbar that would call that
macro.
You were correct, I believe, in suggesting the subroutine. I haven't gotten
it all to work right, but I think I am on the correct path now.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.