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: 205
Default 1D Array Problem (Subscript Out Of Range)

Hi there,

I'm sure this is blindingly obviously but I have a UBound function returning
0 when I can see (in the locals window) that the array has been filled, so I
never get past the first loop of "For x.....". Here's the code:

Private Sub PopulateSheet(ByRef vFilesArray As Variant)

Dim iCol As Integer
Dim iStartRow As Integer
Dim wks As Worksheet

Set wks = Application.Worksheets(1)
iCol = 2
iStartRow = 5 'Starting row

For x = 0 To UBound(vFilesArray, 1)
wks.Cells(iStartRow + x, iCol).Value = vFilesArray(x)
Next x
End Sub

Can anyone tell me what I'm doing wrong please?

FYI - Locals window gives the following values:

- : vFilesArray(0) : : Variant/String(0 to 3)
: vFilesArray(0)(0) : "018.jpg" : String
: vFilesArray(0)(1) : "056.jpg" : String
: vFilesArray(0)(2) : "089.jpg" : String
: vFilesArray(0)(3) : "135.jpg" : String

Best regards

John


 
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
Subscript out range error when redimensioning dynamic array Crazy Cat Excel Programming 1 January 12th 06 06:25 AM
array: subscript out of range rachel Excel Programming 9 November 9th 04 03:03 AM
Subscript out of range problem JE McGimpsey Excel Programming 0 September 15th 04 05:55 PM
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 07:17 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"