Editar Macro Excel para transferir datos de hoja2 a Hoja1
Para Adriel
Hola Adriel, tengo tu macro la cual quier ousar para lo siguiente; según imágenes explicitas
Sub compara_copia_ordena() '//Por Adriel Ortiz ' Set h1 = Sheets("Hoja1") Set h2 = Sheets("Hoja2") ' For i = 2 To h2.Range("A" & Rows.Count).End(xlUp).Row Set b = h1.Columns("A").Find(h2.Cells(i, "A"), lookat:=xlWhole) If b Is Nothing Then u1 = h1.Range("A" & Rows.Count).End(xlUp).Row + 1 h2.Cells(i, "A").Copy h1.Range("A" & u1) u1 = u1 + 1 End If Next i u = h1.Range("A" & Rows.Count).End(xlUp).Row With h1.Sort .SortFields.Clear .SortFields.Add Key:=h1.Range("A2:A" & u), SortOn:=xlSortOnValues, _ Order:=xlAscending, DataOption:=xlSortNormal .SetRange h1.Range("A1:A" & u) .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With End Sub
Tengo Hoja 1
Tengo Hoja 2
Según tu macro, la cual no esta echa para el fin que deseo, ejecutándola me queda así
Pero quiero que queda así
Ordenado hoja1 por B, trayendo todos los datos de cada producto
Si se puede también ordenar la Hoja2 con la misma macro
1 Respuesta
Respuesta de Adriel Ortiz Mangia
1