Delete all words not found in dictionary

SaltGary

New Member
Joined
Jan 21, 2019
Messages
5
I have a table with several thousand foreign words (Hrvatski to be precise which is spoken in Croatia) which is mixed with a few English words. What I need to do is delete all the words in this table (words are in columns A-D) that are NOT found in the English Excel dictionary. In other words (pardon the pun :) , I need to delete all of the Hrvatski-Croatia words. Any help with this would be GREATLY appreciated!

Thank you!

Gary
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Separate word in each cell? Are they formulas or just text? What is the range of cells to be tested? Its possible i think to use the spell checker on each word.
 
Upvote 0
Thank you for your reply!
Yes, each cell has a single word. There are NO formulas, just single words. Cell range for each row is as follows: A2:A19435, B2:B10002, C2:C75219, D2:D33213.
 
Upvote 0
Also, some cells contain special characters and the Hrvatski language uses diacritical marks above some of their characters-these all I guess would have to be ignored?
[h=3][/h]
 
Upvote 0
Try this on a test workbook!

Code:
Function SpellWord(sWord As String) As Boolean

With Application
    SpellWord = .CheckSpelling(sWord, True, True)
End With

End Function

Sub DeleteWordsNotInDictionary()

Dim sh As Worksheet, lr As Long, arr, i As Long, j As Long

With Sheets("Sheet1")
    lr = .Range("A:D").Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
    arr = .Range("A1:D" & lr)
    For i = LBound(arr, 1) To UBound(arr, 1)
        For j = LBound(arr, 2) To UBound(arr, 2)
            If Not IsError(arr(i, j)) Then
                If Len(arr(i, j)) > 0 Then
                    If SpellWord(CStr(arr(i, j))) = False Then
                        arr(i, j) = vbNullString
                    End If
                End If
            End If
        Next
    Next
    .Range("A1:D" & lr) = arr
End With

End Sub
 
Upvote 0
I have it running (screen is all white). It appears to be working, the computer is busy so that is a good sign! I will let it run overnight.
What sort of out put should I expect?

Thanks again!
 
Upvote 0
Its going to take a little while as its got to test quite a lot of values. The output should be the same values in the same cells but without any words not found in the spell checker.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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