Hi everybody,
The following macro searches for missing combinations. This macro will search the complete list and will return any missing combination from "1, 2, 3, 4" to "7, 8, 9, 10".
Sub missing_combos()
Dim dic As Object, q As Variant
Dim a&, b&, c&, d&, k&
Set dic = CreateObject("scripting.dictionary")
q = Range([g5], [j5].End(4))
For a = 1 To UBound(q)
dic(Join(Array(q(a, 1), q(a, 2), q(a, 3), q(a, 4)), ",")) = 1
Next a
For a = 1 To 10
For b = a + 1 To 10
For c = b + 1 To 10
For d = c + 1 To 10
If dic(Join(Array(a, b, c, d), ",")) <> 1 Then
k = k + 1
Cells(k + 1, "l").Resize(, 4) = Array(a, b, c, d)
End If
Next d
Next c
Next b
Next a
End Sub
I need your help to make some changes in this macro, so that it will search for missing combinations only within a specified range of cells (and not the whole list). For example (see excel file attached), I would like to place a search within range("G23:J183"), from combination "1, 2, 6, 9" to combination "4, 6, 8, 10". In this case, it should return only 9 missing combinations.
Any help is welcomed. Thank you very much.
John
Bookmarks