Home > Software engineering >  Excel are defined in the two-dimensional array, too many elements lead to restart, please help
Excel are defined in the two-dimensional array, too many elements lead to restart, please help

Time:10-06

Circulation judgment and output data, with the definition of the array to restart, sorrow
The HTML code is as follows, :
Sub honcs201 ()

Dim arr (1 To 400000, 1 To 800)


For SCT=1 To 12
For t1=1 To 20
For t2=t1 + 1 To 21
For t3=t2 + 1 To 22
For the t4=t3 + 1 To 23
For t5=t4 + 1 To 24
For t6=0 + 1 To 25
For t7 has=t6 + 1 To 26
For t8=t7 has + 1 To 27
For t9=t8 + 1 To 28
For t10=t9 + 1 To 29
For t11=t10 + 1 To 30
+ 1 To 31 For t12=t11
Ts=IIf (t1 Mod=1, 2, 1, 0) + IIf (t2 Mod=1, 2, 1, 0) + IIf (t3 Mod 2=1, 1, 0) + IIf (t4 Mod 2=1, 1, 0) + IIf (t5 Mod 2=1, 1, 0) + IIf (t6 Mod 2=1, 1, 0) + IIf (t7 has Mod 2=1, 1, 0) + IIf (t8 Mod 2=1, 1, 0) + IIf (t9 Mod 2=1, 1, 0) + IIf (t10 Mod 2=1, 1, 0) + IIf (t11 Mod 2=1, 1, 0) + IIf (t12 Mod 2=1, 1, 0)
If ts=SCT Then

H=h + 1
Arr (h, 1)=t1
Arr (h, 2)=t2
Arr (h, 3)=t3
Arr (h, 4)=t4
Arr (h, 5)=0
Arr (h, 6)=t6
Arr (h, 7)=t7 has
Arr (h, 8)=t8
Arr (h, 9)=t9
Arr (h, 10)=t10
Arr (h, 11)
=t11Arr (h, 12)=t12

End the If

Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next



Range (" a1 "). The Resize (100, 972). The Value=https://bbs.csdn.net/topics/arr
Range (al2)=Format (Timer - Timer1, "00:00. 0000")
End Sub

CodePudding user response:


Read the redesign the logic, can be simplified,

CodePudding user response:

Output to the first. The CSV (half Angle commas between columns, carriage returns between lines of plain text)
To read in the Excel,

CodePudding user response:

31 selected 12 141120525 combinations, I want to do

CodePudding user response:

13 layers for loop, inside still have so many iif () function,

Crazy khan...

CodePudding user response:

Dim arr (1 To 400000, 1 To 800)
Could you tell me what your excel version? The 2003 version can not meet the requirements of you

Additional code thinking should be optimized

CodePudding user response:

 Dim arr (1 To 400000, 1 To 800) 
Members' data types for the Variant, the length of the 16 bytes, '
'memory # 400000 * 800 * 16 material 4.8 G'
'a 32-bit program does not have so much memory! '

 Dim arr (1 To 1 To 400000, 800) As Byte 
Members' value maximum 31, with Byte enough, length is 1 Byte, '
'400000 memory & amp; 305 * 800 * 1 material m '
'should be ok,'

CodePudding user response:

EXCEL can't take up too much, memory, and program running time cannot too long,,, I have experience greatly,,,,

If you must take up too much memory and running time is long, please try to join a breakpoint or msgbox, pause before his dead to continue your program, please use other languages such as VB/VC for processing,
  •  Tags:  
  • VBA
  • Related