Sorting 2 colums to get numbers to match ?

R

ryguy7272

I think this will do what you want (but it only works on two columns; A and B):

Sub Matching_Cell()
Dim rng As Range, cell As Range
Set rng = Range(Range("A1"), Range("A65536").End(xlUp))
Application.ScreenUpdating = False
For Each cell In rng
With cell
If .Offset(0, 1) = "" Then Exit For
If .Value < .Offset(0, 1).Value Then
..Offset(0, 1).Insert
ElseIf .Value > .Offset(0, 1).Value Then
..Insert
End If
End With
Next
End Sub


Regards,
Ryan---
 
M

Max

This might work as well
Assuming source data in cols A and B as posted, from row1 down
In C1:
=IF(ISNUMBER(MATCH(A1,B:B,0)),A1,"")
Copy C1 down to the last row of data in col A
Col C returns the aligned results that you seek for the values in col B
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top