A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Sub doit()
Const nItems As Long = 3 ' up to 20 in XL2007+
Const xMax As Long = 2 ^ nItems - 1
Dim x As Long, t As Long, i As Long
Dim s As String, res(0 To xMax, 1 To 1) As String
If nItems > Log(Rows.Count) / Log(2) Then
MsgBox "too many"
Exit Sub
End If
Columns("a").Clear
For x = 0 To xMax
t = x: s = ""
For i = 1 To nItems
s = IIf(t And 1, "True", "False") & ", " & s
t = t \ 2
Next i
res(x, 1) = Left(s, Len(s) - 2)
Next x
Range("a1:a" & xMax + 1) = res
Columns("a").AutoFit
MsgBox "done"
End Sub
Caveat: Before setting nItems very large, I suggeest that you test the behavior using increasing values for nItems. On my laptop, the performance started to decline badly for nItems > 15, although it did work eventually. I suspect that memory and/or cache management becomes a performance factor.