LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Application.WorksheetFunction.Correl


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reuse Application.WorksheetFunction jlclyde Excel Discussion (Misc queries) 4 March 12th 09 08:32 PM
Need help with Application.WorksheetFunction Ayo Excel Discussion (Misc queries) 4 May 14th 08 11:13 PM
Application.WorksheetFunction.Upper y Excel Programming 6 April 8th 04 12:43 PM
Application.WorksheetFunction.MMult Gabriel[_3_] Excel Programming 4 December 14th 03 04:40 PM
Using Application.WorksheetFunction.Ln(...) in VBA doco Excel Programming 4 August 25th 03 01:08 PM


All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"