An Add-in question

D

Dan E

I'll provide a little background, I have created a very long and
intricate AGA 8 spreadsheet (calculates gas compressibility).
I would like to have this calculation available to numerous
other spreadsheets. I was hoping I could make an add-in that
would accomplish this.

I am very new to add-ins so . . .

I want to create a function that takes the inputs
Punches them into an existing sheet (contained in the add-in)
Calculates and returns a result from a particular cell on the
sheet.

The reason I want to do this is because if I can't put the info
into the sheet then get the result from the sheet, I will need
to re-program the whole thing in VBA (which is what I'm trying
to avoid)

Sample Code...
Public Function AGA8_92_FULL(Press_PSIA As Single,
Temp_degF As Single, C1 As Single ... ) As Single
Dim CompArray As Variant
AGA8_92C.Range("B2") = Press_PSIA
AGA8_92C.Range("B4") = Temp_degF
CompArray = Array(C1, N2, CO2, C2, ... Ar)
AGA8_92C.Range("B10:B30").Value = CompArray
AGA8_92C.Calculate
AGA8_92C = Range("D10").Value
End Function

Numerous compositional variables removed to save space...

Any thoughts or suggestions are much appreciated.

Dan E
 
D

Dan E

I guess I should mention that the problem is that you cannot
pass arguments to the spreadsheet from within the function.

The code always ends at:
AGA8_92C.Range("B2") = Press_PSIA

Any (and I mean ANY) ways around this (VB, C++, MATLAB)
anything that I could use without rewriting 300 small calc's.

Dan E
 
D

Dave Peterson

Functions called from a worksheet can return values to the cell that contains
the formula. It can't punch values into other cells.

Maybe you could have the users run a macro (Sub) when they've finished entering
data.
 

Ask a Question

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.

Ask a Question

Top