View Single Post
 
Old 07-25-2014, 04:48 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,514
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

It would be nice if you said up-front what the requirements are instead of dishing them out piecemeal. Neither I nor anyone else enjoys writing and re-writing code just because the person asking for it left out some vital information.

Without a complete re-write to accommodate a requirement for gender pairings, you could simply add:
.Range("F" & k).Value = .Range("C" & i).Value & " & " & .Range("C" & j).Value
after:
.Range("E" & k).Value = .Range("B" & i).Value + .Range("B" & j).Value
then add:
Code:
  With .Sort
    .SortFields.Clear
    .SortFields.Add Key:=Range("F1:F" & k), _
      SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .SetRange Range("D1:F" & k)
    .Header = xlNo
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
  End With
before:
End With

This will give you a basic sorted listing, though you'll have ostensibly separate sets for 'F & M' and 'M & F'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote