VBA Auto spelling

Status
Not open for further replies.

Mugiwara

Spammer
Joined
Jun 21, 2022
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
  2. MacOS
Hi,

Is it possible to have a VBA macro for auto spelling check.
Kindly advise, as I am new.

Thank you in advance
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Other than using the F7 key to initiate the built in Spell Checker which I think would be the preferred method.
If you want a macro, does this help you at all. On the first run it will highlight and tell you which words and where that are misspelled. If you run it again (after correcting the spelling) it will remove the highlights and confirm that it did not find any errors.

VBA Code:
Sub BadSpelling()

    Dim spl, cel As Range, i As Long, str As String, loc As String
    
    For Each cel In ActiveSheet.UsedRange
        cel.Style = "Normal"
        If Not Application.CheckSpelling(word:=cel.Text) Then
            cel.Style = "Note"
            spl = Split(cel, " ")
            For i = 0 To UBound(spl)
                If Not Application.CheckSpelling(word:=spl(i)) Then
                    loc = cel.Address(False, False)
                    str = str & UCase(spl(i)) & vbTab & " in cell " & loc & vbNewLine
                End If
            Next
        End If
    Next cel
    If str = "" Then str = "Spell Check Complete"
    MsgBox str
    
End Sub
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,591
Messages
6,120,431
Members
448,961
Latest member
nzskater

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