Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bas Bas is offline
external usenet poster
 
Posts: 3
Default Dynamic array seems invalid

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Dynamic array seems invalid

Not sure what you need the Index function for.
Have a look at this:

Sub test()

Dim i As Long
Dim c As Long
Dim ClusterValues() As Long

ReDim ClusterValues(1 To 10, 1 To 2)

For i = 0 To 9
For c = 0 To 1
ClusterValues(i + 1, c + 1) = i * 2 + c + 1
Next c
Next i

Application.StatusBar = ClusterValues(3, 2)

Range(Cells(1), Cells(10, 2)) = ClusterValues

End Sub


RBS


"Bas" wrote in message
oups.com...
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


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
data validation invalid in dynamic validation list ilia Excel Discussion (Misc queries) 0 November 7th 06 12:54 PM
data validation invalid in dynamic validation list ilia Excel Worksheet Functions 0 November 7th 06 12:54 PM
data validation invalid in dynamic validation list ilia Excel Programming 0 November 7th 06 12:54 PM
Runtime Error 381 Couldn't set list property, invalid array index Newbillian Excel Programming 2 June 17th 04 11:25 AM
Runtime Error 381 Couldn't set list property, invalid array index Newbillian Excel Programming 0 June 16th 04 11:28 PM


All times are GMT +1. The time now is 04:20 PM.

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"