MINCUS1308
02-16-2018, 02:06 PM
I have filled an array and am attempting to output the array.
When I output the array I am only getting the first row of elements.
If I ask for a specific element in the array it will return the correct value.
Filling the array is done with a 'select case' as I step through another array.
Case "TA"
ReDim Preserve arr_B_St_TA(9, c_arr_B_St_TA)
arr_B_St_TA(0, c_arr_B_St_TA) = DFArray(c_DFArray, PRODID)
arr_B_St_TA(1, c_arr_B_St_TA) = DFArray(c_DFArray, ITEMID)
arr_B_St_TA(2, c_arr_B_St_TA) = DFArray(c_DFArray, SCHEDSTART)
arr_B_St_TA(3, c_arr_B_St_TA) = DFArray(c_DFArray, QTYSCHED)
arr_B_St_TA(4, c_arr_B_St_TA) = ""
arr_B_St_TA(5, c_arr_B_St_TA) = ""
arr_B_St_TA(6, c_arr_B_St_TA) = ""
arr_B_St_TA(7, c_arr_B_St_TA) = ""
arr_B_St_TA(8, c_arr_B_St_TA) = "TA: " & DFArray(c_DFArray, ta)
c_arr_B_St_TA = c_arr_B_St_TA + 1
Later I try to output the array
ActiveSheet.Cells(1, 1).Resize(UBound(arr_B_St_TA, 2), 9) = Application.Transpose(arr_B_St_TA)
Which only outputs items manually input
Dim arr_B_St_TA() As Variant
ReDim arr_B_St_TA(9, 1)
arr_B_St_TA(0, 0) = "a"
arr_B_St_TA(1, 0) = "b"
arr_B_St_TA(2, 0) = "c"
arr_B_St_TA(3, 0) = "d"
arr_B_St_TA(4, 0) = ""
arr_B_St_TA(5, 0) = ""
arr_B_St_TA(6, 0) = ""
arr_B_St_TA(7, 0) = ""
arr_B_St_TA(8, 0) = "e"
c_arr_B_St_TA = 1
But when I ask for element
Msgbox arr_B_St_TA(0, 1)
It returns values the correct values
What am I doing wrong? Other than terrible coding practices :)
When I output the array I am only getting the first row of elements.
If I ask for a specific element in the array it will return the correct value.
Filling the array is done with a 'select case' as I step through another array.
Case "TA"
ReDim Preserve arr_B_St_TA(9, c_arr_B_St_TA)
arr_B_St_TA(0, c_arr_B_St_TA) = DFArray(c_DFArray, PRODID)
arr_B_St_TA(1, c_arr_B_St_TA) = DFArray(c_DFArray, ITEMID)
arr_B_St_TA(2, c_arr_B_St_TA) = DFArray(c_DFArray, SCHEDSTART)
arr_B_St_TA(3, c_arr_B_St_TA) = DFArray(c_DFArray, QTYSCHED)
arr_B_St_TA(4, c_arr_B_St_TA) = ""
arr_B_St_TA(5, c_arr_B_St_TA) = ""
arr_B_St_TA(6, c_arr_B_St_TA) = ""
arr_B_St_TA(7, c_arr_B_St_TA) = ""
arr_B_St_TA(8, c_arr_B_St_TA) = "TA: " & DFArray(c_DFArray, ta)
c_arr_B_St_TA = c_arr_B_St_TA + 1
Later I try to output the array
ActiveSheet.Cells(1, 1).Resize(UBound(arr_B_St_TA, 2), 9) = Application.Transpose(arr_B_St_TA)
Which only outputs items manually input
Dim arr_B_St_TA() As Variant
ReDim arr_B_St_TA(9, 1)
arr_B_St_TA(0, 0) = "a"
arr_B_St_TA(1, 0) = "b"
arr_B_St_TA(2, 0) = "c"
arr_B_St_TA(3, 0) = "d"
arr_B_St_TA(4, 0) = ""
arr_B_St_TA(5, 0) = ""
arr_B_St_TA(6, 0) = ""
arr_B_St_TA(7, 0) = ""
arr_B_St_TA(8, 0) = "e"
c_arr_B_St_TA = 1
But when I ask for element
Msgbox arr_B_St_TA(0, 1)
It returns values the correct values
What am I doing wrong? Other than terrible coding practices :)