Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DRA DRA is offline
external usenet poster
 
Posts: 33
Default using array as argument in VBA sub

I am trying to pass an array to a subroutine. I always get an error.

in calling code:
MMBkList = Array("Add to Not Budgeted", "Add to Charity", "Add to
Cash")
Call mylistbox("Add to which Column?", MMBkList, col)
..
..
..

Sub MyListBox(Cptn As String, ByRef List() As Variant, Item)

Help?

Thanks,
DRA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default using array as argument in VBA sub

Changing List() to List will work, however, it would be better to use
another variable name; maybe vList.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"DRA"
wrote in message
I am trying to pass an array to a subroutine. I always get an error.

in calling code:
MMBkList = Array("Add to Not Budgeted", "Add to Charity", "Add to Cash")
Call mylistbox("Add to which Column?", MMBkList, col)

Sub MyListBox(Cptn As String, ByRef List() As Variant, Item)

Help?
Thanks,
DRA
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default using array as argument in VBA sub

Sub MyListBox(Cptn As String, ByRef List, Item)


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"DRA" wrote in message
...
I am trying to pass an array to a subroutine. I always get an error.

in calling code:
MMBkList = Array("Add to Not Budgeted", "Add to Charity", "Add to
Cash")
Call mylistbox("Add to which Column?", MMBkList, col)
.
.
.

Sub MyListBox(Cptn As String, ByRef List() As Variant, Item)

Help?

Thanks,
DRA



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default using array as argument in VBA sub

Try removing the () after List, ie:

Sub MyListBox(Cptn As String, ByRef List() As Variant, Item)

A variant can hold an array by itself. You do not need an array of
Variants.

Regards,
Steve

DRA wrote:
I am trying to pass an array to a subroutine. I always get an error.

in calling code:
MMBkList = Array("Add to Not Budgeted", "Add to Charity", "Add to
Cash")
Call mylistbox("Add to which Column?", MMBkList, col)
.
.
.

Sub MyListBox(Cptn As String, ByRef List() As Variant, Item)

Help?

Thanks,
DRA


  #5   Report Post  
Posted to microsoft.public.excel.programming
DRA DRA is offline
external usenet poster
 
Posts: 33
Default using array as argument in VBA sub

Thanks to all of!

DRA

" wrote:

Try removing the () after List, ie:

Sub MyListBox(Cptn As String, ByRef List() As Variant, Item)

A variant can hold an array by itself. You do not need an array of
Variants.

Regards,
Steve

DRA wrote:
I am trying to pass an array to a subroutine. I always get an error.

in calling code:
MMBkList = Array("Add to Not Budgeted", "Add to Charity", "Add to
Cash")
Call mylistbox("Add to which Column?", MMBkList, col)
.
.
.

Sub MyListBox(Cptn As String, ByRef List() As Variant, Item)

Help?

Thanks,
DRA





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default using array as argument in VBA sub

Or do it this way in Excel 2000 or later:

Sub AAA()
Dim MMBkList() As Variant
MMBkList = Array("Add to Not Budgeted", "Add to Charity", "Add to Cash ")
Call MyListBox("Add to which Column?", MMBkList, col)
End Sub

Sub MyListBox(Cptn As String, ByRef List() As Variant, Item)

End Sub

--
Regards,
Tom Ogilvy

"DRA" wrote in message
...
Thanks to all of!

DRA

" wrote:

Try removing the () after List, ie:

Sub MyListBox(Cptn As String, ByRef List() As Variant, Item)

A variant can hold an array by itself. You do not need an array of
Variants.

Regards,
Steve

DRA wrote:
I am trying to pass an array to a subroutine. I always get an error.

in calling code:
MMBkList = Array("Add to Not Budgeted", "Add to Charity", "Add
to
Cash")
Call mylistbox("Add to which Column?", MMBkList, col)
.
.
.

Sub MyListBox(Cptn As String, ByRef List() As Variant, Item)

Help?

Thanks,
DRA





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
How to get a conditional argument to check all cells in a array? Just 4 Today Excel Worksheet Functions 1 December 9th 06 05:17 PM
VBA function for "Mean" using Array as argument ASokolik Excel Worksheet Functions 21 March 28th 06 10:05 PM
Function (array argument, range argument, string argument) vba Witek[_2_] Excel Programming 3 April 24th 05 03:12 PM
Need help passing an array as an argument blc[_3_] Excel Programming 3 August 4th 04 10:35 PM
Array as Argument in User-Defined Functions Tushar Mehta Excel Programming 0 May 19th 04 04:29 AM


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