|
I wrote a function CreateArray for you, and have an example:
Option Explicit
Private Sub CreateArray (ByVal M As Integer, ByRef ABuf)
ReDim ABuf (2 ^ M-1, M-1)
Dim iRow As Integer
Dim iCol As Integer
Dim iNum As Integer
For iRow = 0 To 2 ^ M-1
iNum = iRow
For iCol = M-1 To 0 Step -1
ABuf (iRow, iCol) = iNum Mod 2
iNum = iNum\2
Next iCol
Next iRow
End Sub
Private Sub Command1_Click ()
Dim A () As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer
k = InputBox ("The value of input M")
CreateArray k, A
For i = 0 To 2 ^ k-1
For j = 0 To k-1
Debug.Print A (i, j);
Next j
Debug.Print
Next i
End Sub |
|