View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson Ken Johnson is offline
external usenet poster
 
Posts: 1,073
Default Sorting columns and Matching

Hi Jeremy,

If you prefer a macro try this out on a backup copy of your sheet...

Public Sub LineThemUp()
Dim iLastRowA As Long
iLastRowA = Range("A" & Range("A:A").Rows.Count).End(xlUp).Row
Dim iLastRowB As Long
iLastRowB = Range("B" & Range("B:B").Rows.Count).End(xlUp).Row
Dim iRowA As Long
Dim iRowB As Long
For iRowA = iLastRowA To 1 Step -1
For iRowB = iLastRowB To 1 Step -1
If Cells(iRowB, 2).Value = Cells(iRowA, 1).Value Then
Let Range(Cells(iRowA, 2), Cells(iRowA, 3)).Value = _
Range(Cells(iRowB, 2), Cells(iRowB, 3)).Value
Range(Cells(iRowB, 2), Cells(iRowB, 3)).ClearContents
Exit For
End If
Next iRowB
Next iRowA


Ken Johnson