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: 215
Default Array Declaration Problem ??

(This is a cross-post)

Hello;

I'm trying to correctly pass the range B11:C14 to the Function MyRoots() and
return the results by the array function to cells I11:J13.

Notice the use of ReDim. Declaring Dim a(m+1,2) As Double in Function
MyRoots() would produce a compile error: "Constant expresion required", and
also I couldn't declare "a" as a 2D dynamic array!

I suspect the array variables declaration in the following example is the
problem.
The array Function MyRoots() incorrectly returns 0.0 results to cells I11:J13.

cell B8::3
cell B9: myTrue
cells B11:C14 numerical values
cells I11:J13:: array function {=MyRoots(B11:C14, B8, B9)}

Function MyRoots (a, m As Integer, polish As String)
ReDim a(m + 1, 2) As Double
ReDim roots(m, 2) As Double
Dim j As Integer, its As Integer
Dim x(2) As Double
ReDim ad(m + 1, 2) As Double
.......................................my code............
For j = 1 To m + 1
ad(j, 1) = a(j, 1)
ad(j, 2) = a(j, 2)
Next j
.......................................my code............
Call Laguer (ad, j, x, its)
.......................................my code............
roots(j, 1) = x(1)
roots(j, 2) = x(2)
.......................................my code............
MyRoots = roots
End Function

Sub Laguer (a, m, x, its)
Dim x1(2) As Double
.......................................my code............
x(1) = x1(1)
x(2) = x1(2)
.......................................my code............
Exit Sub
End Sub

Your expert help would be greatly appreciated.

Regards.
 
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
Array Declaration. apis Excel Discussion (Misc queries) 1 November 5th 11 01:53 PM
Declaration problem davidm Excel Programming 6 August 25th 05 05:03 AM
VBA Declaration problem Shawn Excel Programming 2 July 17th 05 10:44 PM
Array Declaration mikey10[_6_] Excel Programming 2 October 18th 04 08:19 PM
dYNAMIC Array declaration, a small correction in my last thread! aiyer[_45_] Excel Programming 1 August 18th 04 01:13 AM


All times are GMT +1. The time now is 05:50 PM.

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"