Bordear celdas coincidentes en ambas hojas
Como puedo ejecutar este código y que en la segunda hoja me bordee los mismos datos que están en la columna "o" de la primer hoja
Sub buscar_reemplazar_BORDE() Application.ScreenUpdating = False Dim lookup 'opcional: quitar bordes anteriores Set DATOS = Range("AF1:AJ42").CurrentRegion DATOS.Borders.LineStyle = xlNone 'se toma la selección desde el rango AI lookup = ActiveCell.Value 'se guarda en AK1 ... ya tiene color y formato la celda ActiveCell.Copy Range("H1").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _ xlNone, SkipBlanks:=False, Transpose:=False 'preparar col AR con lista de rango AM:AP With Range("O:O") .ClearContents .NumberFormat = "@" End With x = Range("J" & Rows.Count).End(xlUp).Row finy = 2 For Z = 1 To x nrox = Format(Range("J" & Z) & Range("K" & Z) & Range("L" & Z) & Range("M" & Z), "0000") If InStr(1, UCase(nrox), "X", 0) = 0 Then Range("O" & finy) = nrox: finy = finy + 1 End If Next Z Set DATOS = Range("AF1:AJ42").CurrentRegion Set lista = Range("O1").CurrentRegion MATRIZ = DATOS With lista For i = 2 To .Rows.Count numeros = .Cells(i, 1) cuenta = WorksheetFunction.CountIf(DATOS, numeros) If cuenta > 0 Then For j = 1 To cuenta If j = 1 Then Set busca = DATOS.Find(Format(numeros, "0000"), lookat:=xlWhole) If j > 1 Then Set busca = DATOS.FindNext(busca) On Error Resume Next Celda = busca.Address With Range(Celda) .BorderAround ColorIndex:=0, Weight:=xlThick End With Next j Else GoTo SIGUIENTE End If On Error GoTo 0 SIGUIENTE: Next i End With SALIDA: End Sub
1 Respuesta
Respuesta de Dante Amor
1