Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default passing arrays between functions in VBA

Only a variant can be assigned an array - however, there usually is no need
to assign it if you pass it through the arguments of the function - but
since you are giving it a new name, I assume you are assigning it.

I would advise against calling your array "Array" since this is a keyword.
--
Regards,
Tom Ogilvy

"goltinfron" wrote in message
...
Ok, this may sound stupid, but, I have a program where I call in a nxm

array, I will call it array0. That array is then sent to another function,
and comes back, I'll call it array1. I then use try to use array1 in another
function, but I get an error message. Do I need to redefine array1 as a
variant before I use in another function?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default passing arrays between functions in VBA

Tom thanks, but that is not exactly what I was getting at. Maybe this will make thing clearer

function coordinates(coord

ReDim a(row,column) As Varian
Dim b() As Doubl

a=coordinates2(coord) 'where coordinates2 is second functio

b=coordinates3(a) 'where coordinates 3 is a third functio

after this, i go on and do other stuff

My problem is that I can get the proper answer for a, but when I try to use a in equation b, it comes up with an erro

Sean
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default passing arrays between functions in VBA

Pretty sketchy data (like you didn't state what the error message is),
but I assume that it is "Can't assign to array". If so, this is not a
problem with a but is because b is declared as Double(). You can't
assign directly to a non-Variant() array.

Alan Beban

goltinfron wrote:
Tom thanks, but that is not exactly what I was getting at. Maybe this will make thing clearer.

function coordinates(coord)

ReDim a(row,column) As Variant
Dim b() As Double

a=coordinates2(coord) 'where coordinates2 is second function

b=coordinates3(a) 'where coordinates 3 is a third function

after this, i go on and do other stuff.

My problem is that I can get the proper answer for a, but when I try to use a in equation b, it comes up with an error

Sean


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default passing arrays between functions in VBA

seems exactly what you were getting at:

Only a variant can be assigned an array


--
Regards,
Tom Ogilvy

"goltinfron" wrote in message
...
Tom thanks, but that is not exactly what I was getting at. Maybe this will

make thing clearer.

function coordinates(coord)

ReDim a(row,column) As Variant
Dim b() As Double

a=coordinates2(coord) 'where coordinates2 is second function

b=coordinates3(a) 'where coordinates 3 is a third function

after this, i go on and do other stuff.

My problem is that I can get the proper answer for a, but when I try to

use a in equation b, it comes up with an error

Sean



Reply
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
Functions/arrays LLama Excel Discussion (Misc queries) 3 July 11th 07 10:23 AM
passing arrays to user defined functions ramki Excel Worksheet Functions 2 February 15th 06 08:34 AM
Passing parameters between functions Gaston[_7_] Excel Programming 4 February 9th 04 04:08 AM
Passing Parameters to Userdefined Functions Peter M[_3_] Excel Programming 3 December 13th 03 07:56 PM
Passing arrays to a subroutine Braden Craig Excel Programming 4 August 17th 03 05:54 PM


All times are GMT +1. The time now is 06:12 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"