Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic array seems invalid, but why?

Status
Not open for further replies.

Bas2

Programmer
May 20, 2007
1
NL
Hi all,

First of all, I'm a relative newbie when it comes to arrays. I tried
to generate a dynamic array , named 'ClusterValues()' . When I point
my mouse over 'Array(TStV4)' it seems(!) to be a valid array 'saying'
"1, 2, 3" , when I test this array using:

'Application.StatusBar = WorksheetFunction.Index(ClusterValues(), 1,
1)' , the whole array is printed within the status bar, but what wend
wrong?

Thanks in advance!

- Bas

Option Base 1
--
Sub test()

Dim ClusterMembers() As Variant
Dim ClusterValues() As Variant
Dim TBV As Byte
Dim TIV2 As Integer
Dim TIV4 As Integer
Dim TStV4 As String

For TIV4 = 1 To TBV - 1 Step 1
TStV4 = TStV4 & WorksheetFunction.Index(Range("A1").Offset(TIV2,
0).Range("A1:CS1"), 0, WorksheetFunction.Index(ClusterMembers(), 1,
TIV2)) & ", "
Next

TStV4 = TStV4 & WorksheetFunction.Index(Range("A1").Offset(TIV2,
0).Range("A1:CS1"), 0, WorksheetFunction.Index(ClusterMembers(), 1,
TBV))
ClusterValues() = Array(TStV4)

End Sub
 
Replace this:
ClusterValues() = Array(TStV4)
with this:
ClusterValues = Split(TStV4, ",")


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top