How to find all underlined texts in a range or whole worksheet in Excel?
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.
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.
4. Click OK, then a dialog will pop out to tell you which cells are single underlined texts, and which are double underlined texts.
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.
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:
2. Then select the range you want to find out the specific underlined texts, and click Kutools > Select > Select Cells with Format. See screenshot:
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:
4. Click OK, and in the Select Cells with Format dialog, check Underline only. See screenshot:
5. Click Ok, then a dialog pops out to remind you how many underlined texts are selected, click Yes to close it.
Now all the underlined texts are selected.
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
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...
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!