Para Dante: agregar diccionario a este código

dragonfire33

Board Regular
Joined
Oct 7, 2021
Messages
90
Office Version
  1. 365
Platform
  1. Windows
Hola Dante como puedo agregarle la función diccionario a este codigo para que se ejecute más rápido el código como el anterior código que me realizaste

Excel Formula:
Sub Repetidos()

'Por.Dante Amor

    col = "TG"

    '

    Application.ScreenUpdating = False

    c = Columns(col).Column

    Range(Cells(1, c), Cells(1, c + 2)).EntireColumn.ClearContents

    For Each n In Range("A1:SZ217").SpecialCells(xlCellTypeConstants, 23)

        Set b = Columns(c).Find(n.Value, lookat:=xlWhole)

        If Not b Is Nothing Then

            Cells(b.Row, c + 1) = Cells(b.Row, c + 1) + 1

            Cells(b.Row, c + 2) = Cells(b.Row, c + 2) & ", " & n.Address(False, False)

        Else

            u = Range(col & Rows.Count).End(xlUp).Row + 1

            Cells(u, c) = n.Value

            Cells(u, c + 1) = 1

            Cells(u, c + 2) = n.Address(False, False)

        End If

    Next

    For i = u To 1 Step -1

        If Cells(i, c + 1) = 1 Then

            Range(Cells(i, c), Cells(i, c + 2)).Delete Shift:=xlUp

        End If

    Next

    '

    With ActiveSheet.Sort

        .SortFields.Clear

        .SortFields.Add Key:=Range(Cells(1, c + 1), Cells(u, c + 1)), _

            SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal

        .SetRange Range(Cells(1, c), Cells(u, c + 2))

        .Header = xlGuess

        .MatchCase = False

        .Orientation = xlTopToBottom

        .SortMethod = xlPinYin

        .Apply

    End With

    Application.ScreenUpdating = True

    MsgBox "Fin"

End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top