![]() |
An Add-in question
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 |
An Add-in question
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 "Dan E" wrote in message ... 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 |
All times are GMT +1. The time now is 05:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com