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: 39
Default Array range error question

When i try to redim my array i get an out of range error. can someone tel me
why?
Cells A1..A10 are filled with strings. thanks much

Sub Get_names_array()
Dim names_array() As Variant 'dynmanic
Dim j As Long

ReDim names_array(5, 1)

j = 0
Range("A1").Select
For i = 1 To 10
names_array(j, 0) = ActiveCell.Value
names_array(j, 1) = ActiveCell.Address
arraylimitFirst = UBound(names_array, 1) 'returns current dimension of 1st
array limit, init = 5
If j = arraylimitFirst Then
ReDim Preserve names_array(10, 1) ' << RANGE ERROR 9 SUBSCRIPT OUT OF RANGE
j = j + 1
End If
ActiveCell.Offset(1, 0).Select 'down one
j = j + 1
Next i
End Sub

 
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
array, range question mwam423 Excel Discussion (Misc queries) 4 August 23rd 07 01:36 AM
array from range question Gary Keramidas Excel Programming 2 April 24th 07 07:26 PM
Question about working with range array 39N 95W Excel Programming 2 January 18th 06 11:49 PM
Array <-- Range Error MDW Excel Programming 3 November 8th 05 07:41 PM
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM


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