View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Matching Problem Possible?

Please TOP post in this forum. You did not say so in the first post. If you
want to sort the 1st column then use this

Sub reorderdata()
lr = Cells(Rows.Count, "g").End(xlUp).Row
Range("g2:g" & lr).Sort key1:=Range("g2"), Order1:=xlAscending
For i = lr To 2 Step -1
x = Columns(8).Find(Cells(i, "g")).Row
Cells(i, "j") = Cells(x, "h")
Cells(i, "k") = Cells(x, "i")
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Saxman" wrote in message
...
On 02/08/2007 17:07:52, "Don Guillett" wrote:
In helper columns just use VLOOKUP or a macro to reorder.
Or a macro assuming your data starts in col G to make helper columns. You
could then delete the old h & i cols.

Sub reorderdata()
For i = Cells(Rows.Count, "g").End(xlUp).Row To 2 Step -1
x = Columns(8).Find(Cells(i, "g")).Row
Cells(i, "j") = Cells(x, "h")
Cells(i, "k") = Cells(x, "i")
Next i
End Sub


I think the problem is best sorted with a macro to sort column A, A-Z and
then column B, A-Z together with the information in column B.