I'm afraid there's a little problem, sorry to bother again 
I was trying the code in a test file, with only 2 columns on each sheet, and it all worked well. However, I tried to implement it on the file I really need, which has a lot of columns on Sheet3, and the code only moved 2 columns down. So I did some alterations to the code (the columns have changed) and this is what I have now:
Sub ertert()
Dim x, i&
With Sheets("Sheet3")
x = .Range("B1:C" & .Cells(Rows.Count, 2).End(xlUp).Row).Value
End With
With CreateObject("Scripting.Dictionary")
.CompareMode = 1
For i = 1 To UBound(x): .Item(x(i, 2)) = x(i, 1): Next i
With Sheets("CADIM")
x = .Range("A1:B" & .Cells(Rows.Count, 1).End(xlUp).Row).Value
End With
For i = 1 To UBound(x): .Item(x(i, 2)) = x(i, 1): Next i
Sheets("Sheet3").Range("B1:C1").Resize(.Count).Value = WorksheetFunction.Transpose(Array(.items, .keys))
End With
With Sheets("Sheet3")
With .Range("A1:AZ" & .Cells(Rows.Count, 2).End(xlUp).Row)
.Sort Key1:=.Cells(2, 3), Order1:=xlDescending
End With
End With
End Sub
Sheet3 was already done by someone and sheet CADIM was made by me, so now I'm using ONLY columns A and B. The ideal way to do what I need would be to insert an entire row on Sheet3 and then write in columns B and C the corresponding values of columns A and B from CADIM (all the other columns of that row would be left blank).
37em.jpg
What is happening now is it does insert the new values on columns B and C as I want, but it also inserts random (?) values on the rest of the columns. It appears that it copies those values from some other row, but I can't tell why because they are too many.
Bookmarks