Hi community!
Some time ago I came accross this code (from Ozgrid I believe), and have been working on different approaches to make it faster (when there's a lot of text, it can take some time).
What it does is extract all unique words from a range, and count the number of times that word appears.
Hopefully someone out there can think of a better approach. Thank you!
Some time ago I came accross this code (from Ozgrid I believe), and have been working on different approaches to make it faster (when there's a lot of text, it can take some time).
What it does is extract all unique words from a range, and count the number of times that word appears.
Hopefully someone out there can think of a better approach. Thank you!
Code:
Dim rngData As Range
Dim rngCell As Range
Dim colWords As Collection
Dim vntWord As Variant
Dim Counter As Integer
Dim PctDone As Single
Dim TotalCells As Integer
On Error Resume Next
With Sheet5
Set colWords = New Collection
Set rngData = Sheet5.Range("A2:A" & .Range("A65536").End(xlUp).Row)
TotalCells = rngData.Cells.Count
For Each rngCell In rngData.Cells
For Each vntWord In Split(Replace(Replace(Replace(rngCell.Value, """", ""), "]", ""), "[", ""), " ")
colWords.Add colWords.Count + 1, vntWord
With Sheet1.Cells(1 + colWords(vntWord), 3)
.Value = vntWord
.Offset(0, 1) = .Offset(0, 1) + 1
End With
Next
Next
End With