I have a grid in excel which I want to write to based on 20 different possible filtered variations on a set of data contained in an array. This grid will be used to populate excel charts
I've set up an array of arrays using
then redimension the array ready for loading data using
This is a workaround at the moment as I would prefer to redim the inner bound rather than the outer.
The perfect set up would be to have the data stored as 'chart_data(combo_count).write_array(rows, columns)'
but due to limitations of Redim in VBA I'm forced to use 'chart_data(combo_count).write_array(columns, rows)'
Ideally I would like to perform this function in the fastest most efficient way possible
this would allow the data to be in the correct layout for writing back to excel using a simple
Any ideas on how to achieve this without looping if possible are greatly appreciated?
I've set up an array of arrays using
Code:
Private Type OsArray
write_array() As Variant
End Type
Dim chart_data(1 To 20) As OsArray
then redimension the array ready for loading data using
Code:
On Error Resume Next
chartdata_bound = UBound(chart_data(combo_count).write_array, 2) + 1
If Err.Number = 9 Then 'array is uninitialized
ReDim Preserve chart_data(combo_count).write_array(1 To 10, 1 To 1)
Else
ReDim Preserve chart_data(combo_count).write_array(1 To 10, 1 To chartdata_bound)
End If
On Error GoTo 0
The perfect set up would be to have the data stored as 'chart_data(combo_count).write_array(rows, columns)'
but due to limitations of Redim in VBA I'm forced to use 'chart_data(combo_count).write_array(columns, rows)'
Ideally I would like to perform this function in the fastest most efficient way possible
Code:
'ReDim Preserve chart_data(combo_count).write_array(1 To chartdata_bound, 1 To 10)
this would allow the data to be in the correct layout for writing back to excel using a simple
Code:
.range("whatever").value = chart_data(combo_count)
Any ideas on how to achieve this without looping if possible are greatly appreciated?