Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Err.Number=1004 occurs at the Application.WorksheetFunction.Correl function call. Why? Please refer my macro code snippet below: For intCtr1 = 1 To intFOcount For intCtr2 = 1 To intFOcount Set rngRange1 = Range(wshOut3.Cells(2, intCtr1 + 1).Address(), wshOut3.Cells(intNumdays + 1, intCtr1).Address()) Set rngRange2 = Range(wshOut3.Cells(2, intCtr2 + 1).Address(), wshOut3.Cells(intNumdays + 1, intCtr2).Address()) 'this statement below throws Err 1004, why? dblCorrel = Application.WorksheetFunction.Correl(rngRange1, rngRange2) wshOut2.Cells(intCtr1 + 1, intCtr2 + 1) = dblCorrel Next intCtr2 Next intCtr1 'Objective: To find the correlation of two futures contracts, given their closing price. 'Description of variables: 'intFOcount: The total number of (futures) contracts (scrip names) 'wshOut3: Of type worksheet is Sheet3 of the output file wherein the closing price is written in vertical columns using another macro 'intNumdays: Total number of days for which I extract the closing price of each contract 'intCtr1, intCtr2: Loop variables 'dblCorrel: wish to store the correlation (rho) value in this variable TIA!! Regards, BR -- Manager, International Private Banking, International Banking Group, ICICI Bank East Wing 8th floor South, ICICI Towers, Bandra Kurla Complex, Mumbai India 400051 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Reuse Application.WorksheetFunction | Excel Discussion (Misc queries) | |||
Need help with Application.WorksheetFunction | Excel Discussion (Misc queries) | |||
Application.WorksheetFunction.Upper | Excel Programming | |||
Application.WorksheetFunction.MMult | Excel Programming | |||
Using Application.WorksheetFunction.Ln(...) in VBA | Excel Programming |