VBA code very difficult to understand Help needed

hamadsultan

New Member
Joined
Jan 23, 2011
Messages
49
Hi Experts;
History:
I have a work book that contains 9 number of sheets but two are very important and i use excell 2007 to open it. I found some user defind function in a module which use in the Main worksheet. One of function i posted here also along with the how the programmer use in formula bar.
First code is here
Code:
Function DINTERP2(TAMB, TAMBLOW, TAMBHIGH, PWR, NX, NY, [COLOR=red]TXLOW, TYLOW[/COLOR], TXHIGH, TYHIGH, NFNC)
    Call SINTRP2(PWR, ANSLOW, NX, NY, TXLOW, TYLOW, NFNC, 1)
    Call SINTRP2(PWR, ANSHIGH, NX, NY, TXHIGH, TYHIGH, NFNC, 1)
    DINTERP2 = ANSLOW + ((TAMB - TAMBLOW) / (TAMBHIGH - TAMBLOW)) * ([COLOR=red]ANSHIGH - ANSLOW[/COLOR])
End Function
 
Sub SINTRP2(XN, ANS, NX, NY, TX, TY, NFNC, NDEG)
    NNDEG = NDEG
    If (NX > NDEG) Then GoTo LABLE2
    MsgBox "TABLE TOO SMALL FOR DESIRED DEGREE OF FIT"
    GoTo LABLEEND
LABLE2:
    If ([COLOR=red]XN < TX(1))[/COLOR] Then GoTo LABLE10
    If (XN > TX(NX)) Then GoTo LABLE20
    GoTo LABLE30
Now the programmer use it as;
Code:
=IF(C$13+DATA!F5=0,SINTERP2(E$109,81,11,FLTAMB,OPTDATA,9,1),DINTERP2(E$109,J$69,J$73,E$52,20,9,INDIRECT(J$71),INDIRECT(J$72),INDIRECT(J$75),INDIRECT(J$76),4))*F34
Now I want to undestand the following :
1.ANSLOW and ANSHIGH is used in Dinterp2 function it dfines here and use here i search all the sheets in that workbook they are only in this method. What value it used and where the values come here?
2.The code i copy from the formula bar u see INdirect(J71) and (J72) its Strings come from as J71=J70&"PWR" and same in J72.
But in the function of DINTERP2 its assign TXLOW and TYLow. When SINTRP2 call it used as TX and TY if u see programmer used TX(1) what it means?
Please help me to understand this code.
I pray to God help all the guys who help me always.
Regards
 
Sir;
If i send u a module coding. in it i just want to exccute only some functions when workbook open. if u agree i will send.
Second from where i set the setting that when sheet open the module function run?
Thanks
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,224,505
Messages
6,179,152
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top