Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Arrays as Arguments in Functions

I'm having some trouble with this function. I want to
preserve the values of array between calls to a function.
But I cannot figure out how to define the argument for the
function and what the call function statement should look
like. Has anyone done this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Arrays as Arguments in Functions

You can either declare the arrays as static or as module level variables.

Charles
______________________
Decision Models
The Excel Calculation Site.
www.DecisionModels.com

"Dean" wrote in message
...
I'm having some trouble with this function. I want to
preserve the values of array between calls to a function.
But I cannot figure out how to define the argument for the
function and what the call function statement should look
like. Has anyone done this?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Arrays as Arguments in Functions

Hi Dean,

I'm having some trouble with this function. I want to
preserve the values of array between calls to a function.
But I cannot figure out how to define the argument for the
function and what the call function statement should look
like. Has anyone done this?


Something like this (untested):

Sub Test()

Dim asStuff(0 to 1) As String

asStuff(0) = "Hello"
asStuff(1) = "Goodbye"

MsgBox WhatString(asStuff)

End Sub

Function WhatString(ByRef asArray() As String) As String
WhatString = asArray(0) & ", " & asArray(1)
End Function

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.ie


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Arrays as Arguments in Functions


Thanks! I thought I had to use as Variant and it wasn't working.


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Working with arrays as arguments HB Excel Worksheet Functions 6 September 30th 09 02:48 PM
Errors on Functions with many arguments Ravi Excel Worksheet Functions 1 January 11th 07 03:27 PM
arguments in MATCH and OFFSET functions Dave F Excel Worksheet Functions 1 September 1st 06 03:41 PM
Why do functions not allow commas to seperate arguments JohanS Excel Worksheet Functions 5 May 17th 06 03:56 PM
Need know what are valid SUMPRODUCTS arguments and functions sparham Excel Worksheet Functions 2 October 30th 05 09:32 AM


All times are GMT +1. The time now is 02:29 AM.

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

About Us

"It's about Microsoft Excel"