Borrar formato en esta macro
Para Dante amor, en esta macro que me desarrollaste me gustaría que aparte de borrar el contenido borrara el formato de las celdas. Gracias
Sub CopiarFilas()
'Por.Dante Amor
Set h1 = Sheets("Datos")
Set h2 = Sheets("Q1")
Set h3 = Sheets("Territorio")
'
u3 = h3.Range("B" & Rows.Count).End(xlUp).Row + 1
If u3 < 4 Then u3 = 4
h3.Range("A4:N" & u3).ClearContents
dato = h1.[C1]
If dato = "" Then
MsgBox "Falta la condición a buscar en la hoja " & h1.Name
Exit Sub
End If
'
Set r = h2.Range("B4:B" & h2.Range("B" & Rows.Count).End(xlUp).Row)
Set b = r.Find(dato, lookat:=xlWhole)
If Not b Is Nothing Then
celda = b.Address
Do
'detalle
u3 = h3.Range("B" & Rows.Count).End(xlUp).Row + 1
If u3 < 4 Then u3 = 4
h2.Range("A" & b.Row & ":N" & b.Row).Copy h3.Range("A" & u3)
Set b = r.FindNext(b)
Loop While Not b Is Nothing And b.Address <> celda
End If
MsgBox "Filas copiados"
End Sub
1 Respuesta
Respuesta de Dante Amor
1
