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: 100
Default help! subscript out of range error when trying to return multiple values from function (as variant array)

XL2003

I'm feeding two values into a function, and trying to get three back. I'm
posting simplified code here in the hopes that someone sees something in the
syntax that I'm unaware of (sample code shows the same symptoms). It errors
out when I try to assign the first value of the returned array, with a
'subscript is out of range' error for ConversionData(1).

I was under the impression that the function returns a variant array, so I
should be able to call each individual component later in my code. Where am
I going wrong? The three individual values are being assigned correctly in
the function, and as far as I can tell the transpose code is correct, it
just isn't coming back over to my sub. I tried debug.print xLMSTranslate(1)
but it autoprompts for (text, int) which is my input, not the output variant
array.

Thanks for any help !!!
Keith
'------------------------------------------------------------------

Public ConversionData As Variant 'Array (1 To 3)
Public IntermediateArray(1 To 50000, 1 To 50)


Sub MyMainSub()
ConversionData = xLMSTranslate("MyTextString", 1)
IntermediateArray(1, 7) = ConversionData(1) '*** errors out here
***
IntermediateArray(1, 8) = ConversionData(2)
IntermediateArray(1, 9) = ConversionData(3)
End Sub
'------------------------------------------------------------------

Function xLMSTranslate(BacklogArrayValue As String, SourceNum As Integer) As
Variant
Std = "641"
Bat = "B"
StT = "C"
xLMSTranslate = Application.Transpose(Array(Std, Bat, StT))
End Function





 
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
In multiple sheet copy error subscript out of range ?? HELP Eddy Stan Excel Programming 4 March 22nd 06 04:54 AM
Subscript out range error when redimensioning dynamic array Crazy Cat Excel Programming 1 January 12th 06 06:25 AM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 1 November 8th 05 04:21 AM
Redim 2D Array Subscript Out Of Range Error lopsided[_10_] Excel Programming 6 February 11th 04 08:24 AM
Subscript Out of Range error in Array... Kevin Lyons Excel Programming 3 February 4th 04 06:17 PM


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