# newbie VBA help with programs in excel



## bhav (Dec 30, 2002)

i am new to VBA and need a VBA program that i can call in excel. this program would solve an equation such as one of time dilation: 
t = t0/sqrt(1-(v/c)^2)

i actually have to do this for a number of formulae 
any advice/links to other sites that might explain as to how i can write a VBA function to solve a physics/mathematical formula and call that function in Microsoft excel are appreciated.


----------



## bhav (Dec 30, 2002)

anybody guys?
just need some good links for VBA in MS excel
thanks


----------



## bhav (Dec 30, 2002)

i might not have been very clear, what i want to do is add modules to my spread sheet that would have a program that performs some calculation.(i know i could use a write a formula within the spreadsheet but i would like to do this using code in the module)
what i would like to know is that how would i call a module function(code) as stated above above in the excel spreadsheet??????
and how would i go about calculating a large # of data
any help appreciated, c'mon this can't be too hard!


----------



## AbvAvgUser (Oct 3, 2002)

Can you please clarify the formula? May be you don't need VBA.

I have done some complex calculations in a VBA function earlier in one of the sheets, but I don't remember too much. May be I can help. Or at least I will send you my sheet and you can figure out what has been done.

But as of now, just explain the formaula and its purpose. May be things are easier than they look


----------



## bhav (Dec 30, 2002)

Thanks for the reply AbvAvgUser, this is what i am supposed to do.

"""""""Provide 5 detail algorithms (comments & code) that demonstrate the use of Arrays in VBA and 5 engineering functions that can be called from an excel spreadsheet. A detail algorithm includes a description of the code, the purpose of the code, and each logical commenting of the CODE. code contains the use of arrays. functions accept one or more arguments.
explain how the function is to be used in an excel spreadsheet.""""""""""

what is stated above could simply be done by an excel formula. for example if i was to calculate the speed of a body using the formula V = Distance/TIME, and i was given distance travelled in columnA(20 data values) and time taken is given in columnB(20 data values). SO to calculate the speed in say Column C i would simply put in a formula(=A1/B1) and auto fill till cell C20. 

BUT I HAVE to do this same procedure using VBA. A function has to be written(in this case just a simple function that calculates V=D/T) that uses arrays to make a calculation(V=D/T) for x number of data in a spread sheet. WHAT I"M noT SURE ABOUT is how to write this using arrays. Also i'm not sure how i can CALL such a function in VBA to make a calculation for X number of data.
thanks for any help


----------



## AbvAvgUser (Oct 3, 2002)

You seem to be doing an assignment at some school/university. Is it so?

Anyway, I will see what I can do. But don't rely too much on me, I am not an expert at this. In the mean time, you can try your luck at http://www.theofficeexperts.com.


----------



## bhav (Dec 30, 2002)

Will check it out! thanks
and yeah you could say it is an assignment.


----------

