Please refer to the code below which needs to be tweaked where I am facing difficulties.
There is an array m3a which has a large amount of data which is dumped in a new worksheet when the code is completed. If the data exceeds the number of max rows in excel (1048576), it adds the top 1048575 data in a new array m4a and dumps it. I wish to know that if the data exceeds, how multiple sheets can be created (two sheets, three sheets... etc depending on number of rows in the array. Please help me tweak this piece of code
iLines = 3
startCalc = True
If startCalc Then
Worksheets.Add After:=Worksheets(Worksheets.Count)
Set sh = ActiveSheet
If UBound(m3a, 1) <= Rows.Count Then
sh.Range("A1").Resize(cnt, iLines + 1).Value = m3a
Else
ReDim m4a(1 To 1048575, 1 To iLines + 1)
For i = 1 To 1048575
For j = 1 To iLines + 1
m4a(i, j) = m3a(i, j)
Next j
Next i
sh.Range("A1").Resize(1048575, iLines + 1).Value = m4a
End If
End If
UBound(m3a, 1) <= Rows.Countwork as expected? I think it should beUBound(m3a) <= Rows.Count. Also, is the arraym3aunidimensional or bidimensional?