Hello there! Thank you very much for helping me with this code. So I have this code to highlight words that are misspelled in red, but I would love to also have the cells that contain misspelled words turned "White, Background 1, 15% Darker" (see attached image).
Public Sub ThisOne()
Set MySheet = ActiveSheet
For Each MyCell In MySheet.Range("D8:D1000")
If MyCell.Value <> MyCell.Formula Then GoTo NextCell:
If Application.CheckSpelling(MyCell.Value) Then GoTo NextCell:
MySentence = " " & MyCell.Value
i = 2
While i < Len(MySentence)
If Mid(MySentence, i - 1, 1) = " " And Mid(MySentence, i, 1) <> "" Then
j = InStr(i, MySentence, " ") - 1
If j = -1 Then j = Len(MySentence)
MyWord = Mid(MySentence, i, j - i + 1)
If Not Application.CheckSpelling(MyWord) Then
With MyCell.Characters(Start:=i - 1, Length:=j - i + 1).Font
.Underline = xlUnderlineStyleNone
.Color = RGB(255, 0, 0)
End With
End If
i = j + 1
End If
i = i + 1
Wend
NextCell:
Next MyCell
End Sub
Public Sub ThisOne()
Set MySheet = ActiveSheet
For Each MyCell In MySheet.Range("D8:D1000")
If MyCell.Value <> MyCell.Formula Then GoTo NextCell:
If Application.CheckSpelling(MyCell.Value) Then GoTo NextCell:
MySentence = " " & MyCell.Value
i = 2
While i < Len(MySentence)
If Mid(MySentence, i - 1, 1) = " " And Mid(MySentence, i, 1) <> "" Then
j = InStr(i, MySentence, " ") - 1
If j = -1 Then j = Len(MySentence)
MyWord = Mid(MySentence, i, j - i + 1)
If Not Application.CheckSpelling(MyWord) Then
With MyCell.Characters(Start:=i - 1, Length:=j - i + 1).Font
.Underline = xlUnderlineStyleNone
.Color = RGB(255, 0, 0)
End With
End If
i = j + 1
End If
i = i + 1
Wend
NextCell:
Next MyCell
End Sub
Attachments
Last edited by a moderator: