Hi,
I need to store the total number of entries and I used: Application.CountIf.
I've seen what you can achieve with this code: CreateObject("scripting.dictionary") and I was wondering how to integrate the following request.
I enclose the working code that I tested:
Code:
Option Explicit
Declare Function GetTickCount Lib "kernel32" () As Long
Sub Okk()
Dim Msec As Variant
Dim Via, Avviso As Variant
Via = GetTickCount
Dim dic As Variant
Dim cell As Variant
Set dic = CreateObject("scripting.dictionary")
dic.comparemode = 1
With dic
For Each cell In Range("G2", Cells(Rows.Count, "G").End(xlUp))
.Item(cell.Value) = .Item(cell.Value) + 1
Next cell
Range("M2").Resize(.Count, 1).Value = WorksheetFunction.Transpose(Array(.Items))
End With
Msec = GetTickCount - Via
MsgBox "AVVISO: Tempo impiegato: " & Format$(Msec \ 3600000, "00") & ":" & Format$(((Msec - (Msec \ 3600000) * 3600000)) \ 60000, "00") & ":" & Format$((Msec - (Msec \ 60000) * 60000) / 1000, "00.000")
End Sub
While the following are not able to modify:
Code:
Option Explicit
Declare Function GetTickCount Lib "kernel32" () As Long
Sub NotOkk()
Dim Msec As Variant
Dim Via, Avviso As Variant
Via = GetTickCount
Dim r As Long, dic As Object
Dim Data As Variant
Dim i As Long
r = Range("G" & Rows.Count).End(xlUp).Row
Data = Range("G2:G" & r) 'Original List
ReDim Pos(1 To UBound(Data, 1), 1 To 1)
Set dic = CreateObject("scripting.dictionary")
dic.comparemode = 1
For i = 1 To UBound(Data, 1)
Pos(i, 1) = dic.Item(Data(i, 1))
Next
Range("M2").Resize(UBound(Pos, 1)) = Pos
Msec = GetTickCount - Via
MsgBox "AVVISO: Tempo impiegato: " & Format$(Msec \ 3600000, "00") & ":" & Format$(((Msec - (Msec \ 3600000) * 3600000)) \ 60000, "00") & ":" & Format$((Msec - (Msec \ 60000) * 60000) / 1000, "00.000")
End Sub
Surely if something is not impossible to realize I'd rather it were integrated with previous data from the column count is the "G"
I also ask that the choice between the last 2 the best version that allows this change
Bookmarks