Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2008

Tip: Looking for answers? Try searching our database.

Functions and worksheets, passing arguments to functions?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
newbie - 02 Jan 2008 23:17 GMT
I just got a book called, Excel for Chemists. But it didnt tell me
something i want to know.

I wonder if someone out there can help me?

Here is the problem, say that i have put some data into a worksheet.
A1 cell = XValues and A2 cell = YValues.

If i have a Function that takes 2 arguments below how do i write code
to pass, XValues, Yvalues to the function Deming?

Example below:
Function Deming(XValues, Yvalues)
Dim MeanX(), MeanY()
'Get number of cells to use in calculation loop
Ncells = XValues.Count
ReDim MeanX(Ncells / 2), MeanY(Ncells / 2)
N = 0

put code here......do something...

'Define the return results as an array
Deming = Array(Slope, Intercept)
End Function

I would like to ask a related question as well. To run the programs
do  name the subroutines and functions as macros? Then run the macros
by using the contextual menu and select macro/run/ macro name?

Thank you in advance,
Andrew
Niek Otten - 03 Jan 2008 08:36 GMT
Hi Andrew,

Look here:

http://www.cpearson.com/excel/PassingAndReturningArrays.htm

Signature

Kind regards,

Niek Otten
Microsoft MVP - Excel

|I just got a book called, Excel for Chemists. But it didnt tell me
| something i want to know.
[quoted text clipped - 27 lines]
| Thank you in advance,
| Andrew
newbie - 03 Jan 2008 18:31 GMT
Niek,

Oh! thank you for your quick response to help me! I appreciate you
because my girl friend was asking me how to do this but i didnt know
how to find the information. I bought a book and searched online but
maybe i didnt use the right search string. I am new to VBA so i have a
steep learning curve.

The link you sent looks good so i will print it out and examine the
code. Again, thank you very much!

Andrew & Sayaka

> Hi Andrew,
>
[quoted text clipped - 39 lines]
> | Thank you in advance,
> | Andrew
Niek Otten - 03 Jan 2008 18:54 GMT
You're welcome!

Thanks for the feedback

Signature

Kind regards,

Niek Otten
Microsoft MVP - Excel

Niek,

Oh! thank you for your quick response to help me! I appreciate you
because my girl friend was asking me how to do this but i didnt know
how to find the information. I bought a book and searched online but
maybe i didnt use the right search string. I am new to VBA so i have a
steep learning curve.

The link you sent looks good so i will print it out and examine the
code. Again, thank you very much!

Andrew & Sayaka

On Jan 3, 12:36 am, "Niek Otten" <nicol...@xs4all.nl> wrote:
> Hi Andrew,
>
[quoted text clipped - 41 lines]
> | Thank you in advance,
> | Andrew
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.