Active Member
February 12, 2020
Is there a way to export the words that Excel's Spell Check finds as misspellings to an editable list? Ultimately, I am trying to manually categorize what Excel finds as a misspelled word into acronyms, surnames, truly misspelled words, etc.
January 20, 2019
Solution from ChatGPT:
Sub ExtractMisspelledWords()
Dim rng As Range
Dim cell As Range
Dim misspelledWords As Object
Dim word As Variant
Dim outputRow As Long
' Define the range you want to check for misspellings
Set rng = ThisWorkbook.Sheets("Sheet1").Range("A1:A100")
' Create a dictionary to store misspelled words
Set misspelledWords = CreateObject("Scripting.Dictionary")
' Loop through each cell in the defined range
For Each cell In rng
If Not IsEmpty(cell) Then
For Each word In Split(cell.Value, " ")
If Not Application.CheckSpelling(word) Then
If Not misspelledWords.exists(word) Then
misspelledWords.Add word, Nothing
End If
End If
Next word
End If
Next cell
' Output misspelled words to another worksheet
Set rng = ThisWorkbook.Sheets("Sheet2").Range("A1")
outputRow = 1
For Each word In misspelledWords.keys
rng.Cells(outputRow, 1).Value = word
outputRow = outputRow + 1
Next word
End Sub
Comments from ChatGPT:
Make sure to adjust the Set rng = ThisWorkbook.Sheets("Sheet1").Range("A1:A100") line to specify the correct range and sheet of your data. The script will output the misspelled words to Sheet2. Adjust the script as necessary.
Run the Script:
Close the VBA editor.
Go back to Excel, click on the "Macros" button in the Developer tab, select "ExtractMisspelledWords", and click "Run".
Review the Output:
Once you run the script, go to Sheet2 and you should see a list of the unique misspelled words that were found in your original data.
Now, you can manually categorize the words into acronyms, surnames, truly misspelled words, etc.
Remember to always make a backup of your Excel file before running any VBA script to prevent any unintended changes or data loss.
Answers Post
1 Guest(s)