Correlation of Variables

N

NEWBIE

i'm tring to take the correlation of two different groups
of cells that i store the addresses of in variables. the
problem is that i need to keep the ranges for an arbitrary
group of cells, which is why i use the variables. here's an
example :

adrs = Range(Sheets("Sheet2").cells(2,col),
Sheets("Sheet2").cells(2,col).end(xlDown)).Address

adrs2 = Range(Sheets("Sheet2").cells(2,col),
Sheets("Sheet2").cells(2,col).end(xlDown)).Address

Range("A1")Sselect
' this next line is where i have problems with the addresses
ActiveCell.Formula = "=CORREL( adrs, adrs2 )"


any ideas what to put in the CORREL command to get it to
take the correlation of the two groups of cells? thanks
 
C

Chip Pearson

Try something like

ActiveCell.Formula = "=CORREL(" & adrs & "," & adrs2 & ")"

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
G

Guest

that's perfect! thanks! one more question, how would i do
this if the cells i selected in the beginning were from
lets say sheet1 and the ActiveCell in this example was on
sheet2? any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top