Duda con este codigo para eliminar registros repetidos
Hola tengo este codigo que elimina registros repetidos, si los elimina pero como tengo demasiados registros no me los respeta y borra registros demas.
Espero me puedas adyuar.
Este es el codigo.
Sub borrar_menos1()
Dim a() As String, rng As Range, str As String, i As Long, r As Range
Set rng = Range("C6", Range("C65536").End(xlUp))
start:
For Each r In rng
If Application.CountIf(Range("C6:C" & r.Row), r) > 1 Then
i = i + 1
ReDim Preserve a(1 To i)
a(i) = r.Address(0, 0)
If i = 50 Then
str = Join(C, ",")
Range(str).EntireRow.Delete
i = 0
Erase C
GoTo start
End If
End If
Next
str = Join(C, ",")
If str <> "" Then
Range(str).EntireRow.Delete
End If
Erase C
End Sub
Gracias.
Espero me puedas adyuar.
Este es el codigo.
Sub borrar_menos1()
Dim a() As String, rng As Range, str As String, i As Long, r As Range
Set rng = Range("C6", Range("C65536").End(xlUp))
start:
For Each r In rng
If Application.CountIf(Range("C6:C" & r.Row), r) > 1 Then
i = i + 1
ReDim Preserve a(1 To i)
a(i) = r.Address(0, 0)
If i = 50 Then
str = Join(C, ",")
Range(str).EntireRow.Delete
i = 0
Erase C
GoTo start
End If
End If
Next
str = Join(C, ",")
If str <> "" Then
Range(str).EntireRow.Delete
End If
Erase C
End Sub
Gracias.
Respuesta de patanrisitas
1