How to make word that is not in dictionary to be UNDERLINED?

London12F

Board Regular
Joined
Jun 21, 2016
Messages
59
The following VBA can change word that is not in dictionary to RED:



Code:
[COLOR=#333333]Sub zz()
[/COLOR]<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Dim ws As Worksheet, rng As Range, s$, w$
Set ws = ActiveSheet
    For Each rng In ws.UsedRange
        If rng.HasFormula Then GoSub Nextrng:
        If Application.CheckSpelling(rng.Value) Then GoTo Nextrng:
        s = " " & rng.Value
        i = 2
        While i < Len(s)
            If Mid(s, i - 1, 1) = " " And Mid(s, i, 1) <> "" Then
                j = InStr(i, s, " ") - 1
                If j = -1 Then j = Len(s)
                w = Mid(s, i, j - i + 1)
                If Not Application.CheckSpelling(w) Then
                    rng.Characters(Start:=i - 1, Length:=j - i + 1).Font.Color = vbRed
                End If
                i = j + 1
            End If
            i = i + 1
        Wend
Nextrng:
    Next rng 
</code>[COLOR=#333333]End Sub[/COLOR]


How to revise so that the word that is not in dictionary to be UNDERLINED?

<tbody>
</tbody>
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
oops...correction

Code:
rng.Characters(Start:=i - 1, Length:=j - i + 1).Font.Underline = xlUnderlineStyleSingle

M.
 
Upvote 0
@London12F

You've been told before about cross-posting. Kindly comply with the rules in future or your posting privileges may be revoked. Thank you.
 
Upvote 0
Cross posting is not a problem, but you must provide links to your cross posts please.
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,585
Members
448,972
Latest member
Shantanu2024

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