J
John
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
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