Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. Dan E wrote: 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 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2007 Macro/VB Question DDE Question | Excel Worksheet Functions | |||
where can I see my question and answer? Yesterday I ask a question | Excel Discussion (Misc queries) | |||
Newbie Question - Subtraction Formula Question | Excel Discussion (Misc queries) | |||
The question is an excel question that I need to figure out howto do in excel. | Excel Worksheet Functions | |||
If/ then question | Excel Programming |