RawlinsCross
Active Member
- Joined
- Sep 9, 2016
- Messages
- 437
I have a table of 20 columns to which I want to drop an array of dimensions vArray(1 to 708, 1 to 20). The code below was working but just 'decided' to stop working. When I put a breakpoint before the transfer code I can see the entire array and ALL the data. But when I apply the transfer code only 2 columns are transferred. Has anyone come across this?
Here's the code:
When I check the table only two of the columns (out of 20) has been successfully transferred. I can see that the entire range (1 to 708, 1 to 20) has been selected.
So I'm forced to replace the rRange.Value = vData with the code below that does transfer the array (albeit much slower)
Has anyone come across this?
Here's the code:
VBA Code:
Public Sub TransferArray(vData as Variant) 'Add watch for vData shows all the array columns are filled.
Set wSht as Worksheet
Set rRange as Range
Set wSht = ThisWorkbook.Worksheets("Data")
Set rRange = mwSht.Range("A8").Resize(UBound(vEmployees_, 1), UBound(vEmployees_, 2)) 'A8 is the beginning for the databodyrange of the table
rRange.Value = vData
End Sub
When I check the table only two of the columns (out of 20) has been successfully transferred. I can see that the entire range (1 to 708, 1 to 20) has been selected.
So I'm forced to replace the rRange.Value = vData with the code below that does transfer the array (albeit much slower)
VBA Code:
For i = LBound(vData, 1) To UBound(vData, 1)
For j = LBound(vData, 2) To UBound(vData, 2)
wSht.Cells(i + 7, j) = vData(i, j)
Next j
Next i
Has anyone come across this?