Ahhh, insinúas que lo que hice está feo, está bien, me lo merezco.
Esta es la macro (la de formato feo), para que empiece en la fila 15
Sub buscafilas()
'Por.dam
Set h1 = Sheets("Hoja1")
Set h2 = Sheets("Hoja2")
h1.Select
ufila = ActiveCell.SpecialCells(xlLastCell).Row
ucol = ActiveCell.SpecialCells(xlLastCell).Column
h1.Range(Cells(15, 1), Cells(ufila, ucol)).Clear
datobuscar = h1.Range("A1")
h2.Select
ufila = ActiveCell.SpecialCells(xlLastCell).Row
ucol = ActiveCell.SpecialCells(xlLastCell).Column
ufilap = 15
With h2.Range(Cells(1, 1), Cells(ufila, ucol))
Set datoEncontrado = .Find(datobuscar)
If Not datoEncontrado Is Nothing Then
filaDato1 = datoEncontrado.Row
Do
filadato = datoEncontrado.Row
h2.Rows(filadato).EntireRow.Copy _
h1.Range("A" & ufilap)
ufilap = ufilap + 1
proxima:
Set datoEncontrado = .FindNext(datoEncontrado) 'Busca el siguiente dato
If datoEncontrado.Row = filadato Then filadato = filadato + 1: GoTo proxima:
Loop While Not datoEncontrado Is Nothing And datoEncontrado.Row <> filaDato1
End If
End With
h1.Select
End Sub
Saludos.Dam
Excelente post, estoy haciendo mi libro Mayor, y con esta fórmula me salió bastante bien, gracias. - Ariel Reyes
Hola, esta interesante la macro, pero tengo una duda. como hacer para que no me copie todas las filas hacia el costado y solo me copie dos o tres solamente? - Jonatan Moretto
Hola me podrías ayudar, tu macro me funciona bien pero quisiera que la data se copie en la celda C10 - Fiorella Milachay
cambia esto ufilap = 15 por ufilap = 10 y también cambia h1.Range("A" & ufilap) por h1.Range("C" & ufilap) - Dante Amor