a code to save cells highlighted in yellow to the other sheet

0

as you can do a vba code to save highlighted cells from a range of cells to the next sheet depending on the number of cell "ac1" that would work as a header on sheet 2 I have this code that highlights the cells but I would like that when the process finishes I will automatically save the cells that I frame to the sheet 2

Sub buscar_reemplazar_colorear()
Set DATOS = Range("a1:x36").CurrentRegion
Set lista = Range("al2").CurrentRegion
MATRIZ = DATOS
With lista
    For i = 1 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)
                    .NumberFormat = "@"
                    .Value = Format(lista.Cells(1, 1), "0000")
                    .Interior.ColorIndex = 6
                    .Select
                End With
            Next j
        Else
            GoTo SIGUIENTE
        End If
        ASK = MsgBox("DEJAR TODO COMO ESTABA?", vbYesNo, "AVISO")
        If ASK = 7 Then GoTo SALIDA
        Range(DATOS.Address) = MATRIZ
        On Error GoTo 0
SIGUIENTE:
    Next i
End With
SALIDA:
End Sub

link

    
asked by Jhon Fredy Murcia Rodriguez 25.05.2018 в 01:03
source

0 answers