Results 1 to 2 of 2

Macro to match combinations

Threaded View

  1. #1
    Registered User
    Join Date
    05-15-2008
    Location
    Malaysia
    MS-Off Ver
    MS 2007
    Posts
    12

    Macro to match combinations

    Hi all,

    Need some help to edit the code below....
    Sub Show_4Pluss()
    Range("A1").Select
    Application.ScreenUpdating = False
    N1 = Range("H1").Value
    N2 = Range("P1").Value
    ReDim Data_1(N1, 6), Data_2(N2, 6)
    nRow = 1
    Do While ActiveCell.Offset(nRow, 17).Value <> ""
    ActiveCell.Offset(nRow, 17).Value = ""
    ActiveCell.Offset(nRow, 18).Value = ""
    ActiveCell.Offset(nRow, 19).Value = ""
    nRow = nRow + 1
    Loop
    For I = 1 To N1
    For J = 1 To 6
    Data_1(I, J) = ActiveCell.Offset(I, J).Value
    Next J
    Next I
    For I = 1 To N2
    For J = 1 To 6
    Data_2(I, J) = ActiveCell.Offset(I, J + 8).Value
    Next J
    Next I
    nRow = 0
    For I = 1 To N1
    For J = 1 To N2
    Nx4 = 0
    For K = 1 To 6
    For L = 1 To 6
    If Data_1(I, K) = Data_2(J, L) Then Nx4 = Nx4 + 1
    Next L
    Next K
    If Nx4 >= 3 Then
    nRow = nRow + 1
    ActiveCell.Offset(nRow, 17).Value = I
    ActiveCell.Offset(nRow, 18).Value = J
    ActiveCell.Offset(nRow, 19).Value = Nx4
    End If
    Next J
    Next I
    Application.ScreenUpdating = True
    End Sub
    The above matches a set of combinations with 6 numbers to another combinations with 6 numbers. But now I want it to match with a set of combinations with 7 numbers. This set of 7 numbered combinations will be place in the cells b2:h2 onwards.

    Hope somebody can help me with changing the code. Thanks.

    Flex
    Last edited by Leith Ross; 06-27-2009 at 12:45 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1