Skip to main content

How to find all underlined texts in a range or whole worksheet in Excel?

Author: Sun Last Modified: 2020-09-14

Supposing you have a range of data in a worksheet, and some of the data is with underline, and now you want to find out these data with underline, how can you quickly find out them? Here I introduce some tricks for you to quickly find out the underlined texts in a range or whole worksheet in Excel.

Find all underlined texts in a worksheet with VBA

Find all underlined texts in a range or worksheet with Kutools for Excel good idea3


arrow blue right bubble Find all underlined texts in a worksheet with VBA

In Excel, you cannot use Go To Special function to find out the underlined texts, so I introduce a VBA code to help you find all underlined texts in a worksheet.

1. Press Alt + F11 keys to open Microsoft Visual Basic for Applications window, and click Insert > Module.

2. In the popping Module window, paste below VBA code.

VBA: Find all underlined text in a worksheet.

Sub SearchForUnderline()
'Updateby20150910
    Dim Rg As Range, Rg1 As Range
    Dim I As Long
    Dim xAddress As String, xAddress1 As String, xAddress2 As String
    Dim Result As String
    On Error Resume Next
    xAddress = Application.ActiveWindow.RangeSelection.Address
    Set Rg = Application.InputBox("Please select a range:", "Kutools for Excel", xAddress, , , , , 8)
    If Rg Is Nothing Then Exit Sub
    Set Rg = Application.Intersect(Rg, Application.ActiveSheet.UsedRange)
    If Rg Is Nothing Then Exit Sub
    Set Rg = Rg.SpecialCells(xlCellTypeConstants)
    If Rg Is Nothing Then Exit Sub
    For Each Rg1 In Rg
        For I = 1 To Len(Rg1)
            If Rg1.Characters(I, 1).Font.Underline = xlUnderlineStyleSingle Then
                If xAddress1 = "" Then
                    xAddress1 = Rg1.Address
                Else
                    xAddress1 = xAddress1 & ", " & Rg1.Address
                End If
                Exit For
            End If
        Next
        For I = 1 To Len(Rg1)
            If Rg1.Characters(I, 1).Font.Underline = xlUnderlineStyleDouble Then
                If xAddress2 = "" Then
                    xAddress2 = Rg1.Address
                Else
                    xAddress2 = xAddress2 & ", " & Rg1.Address
                End If
                Exit For
            End If
        Next
    Next
    If xAddress1 <> "" Then Result = "Single underline address:" & vbCr & xAddress1 & vbCr & vbCr
    If xAddress2 <> "" Then Result = Result & "Double underline address:" & vbCr & xAddress2
    If Result <> "" Then MsgBox Result
End Sub

3. Click Run button or press F5 key. And a dialog pops out for select a range to find underlined texts.

doc find underlined text 1

4. Click OK, then a dialog will pop out to tell you which cells are single underlined texts, and which are double underlined texts.

doc find underlined text 2

If you just want to find out one type of underlined texts in a specific range, this VBA code cannot help you, but you can use below handy tool to solve this task in this case.


arrow blue right bubble Find all underlined texts in a range or worksheet with Kutools for Excel

If you have Kutools for Excel installed, you can apply the Select Cells with Format utility to quickly find out the underlined texts in a range of a whole worksheet.

Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. 

After free installing Kutools for Excel, please do as below:

1. Select a blank cell, and then type a data into it, for instance, A1, and click Home > Underline, and select a type of underline you need. See screenshot:

doc find underlined text 3

2. Then select the range you want to find out the specific underlined texts, and click Kutools > Select > Select Cells with Format. See screenshot:

doc find underlined text 4

3. And in the Select Cells with Format dialog, click Choose Format From Cell to select the cell you format with underline in step1. See screenshot:

doc find underlined text 5
doc find underlined text 6

4. Click OK, and in the Select Cells with Format dialog, check Underline only. See screenshot:

doc find underlined text 7

5. Click Ok, then a dialog pops out to remind you how many underlined texts are selected, click Yes to close it.

doc find underlined text 8

Now all the underlined texts are selected.

doc find underlined text 9

Tips:

1. If you want to find out all underlined texts in a whole worksheet, click the left corner of the worksheet to select entire worksheet, and then apply the Select Cells with Format utility.

2. Check Ignore the blank cells in Select Cells with Format dialog, it will ignore the blank cells even though the blank cells are formatted with underline.

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations