Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to convert html to text in cells in Excel?

As below screenshot shown, if numbers of html tags existing in your worksheet cells, how could you convert them to plain text in Excel? This article will show you two methods to remove all html tags from cells in Excel.

Convert html to text in selected cells with Find and Replace function

Convert html to text in the whole worksheet with VBA


Easily remove all commas or specific characters/symbols from selected range:

The Remove Characters utility of Kutools for Excel can help you to remove all commas or specific characters/symbols from cells of selected range easily. See screenshot:

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download the free trial Now!


Convert html to text in cells with Find and Replace function

You can convert all html to texts in cells with the Find and Replace function in Excel. Please do as follows.

1. Select the cells you will convert all html to texts, and press the Ctrl + F keys to open the Find and Replace dialog box.

2. In the Find and Replace dialog box, go to the Replace tab, enter <*> into the Find what box, keep the Replace with box empty, and click the Replace All button. See screenshot:

3. Then a Microsoft Excel dialog box pops up to tell you how many html tags have been replaced, click the OK button and close the Find and Replace dialog box.

Then you can see all html tags are removed from selected cells as below screenshot shown.


Convert html to text in the whole worksheet with VBA

Besides, you can convert all html to text in the whole worksheet at the same time with the below VBA code.

1. Open the worksheet contains html you will convert to text, then press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. In the Microsoft Visual Basic for Applications window, click Insert > Module, then copy below VBA code into the Module window.

VBA code: Convert html to text in the whole worksheet

Sub RemoveHTMLTags()
'Update by Extendoffice 20180703
    Dim xRg As Range
    Dim xCell As Range
    Dim xStr As String
    Dim xRegEx As RegExp
    Dim xMatch As Match
    Dim xMatches As MatchCollection
    Set xRegEx = New RegExp
    Application.EnableEvents = False
    Set xRg = Cells.SpecialCells(xlCellTypeConstants)
    With xRegEx
        .Global = True
        .Pattern = "<(""[^""]*""|'[^']*'|[^'"">])*>"
    End With
    For Each xCell In xRg
        xStr = xCell.Value
            Set xMatches = xRegEx.Execute(xCell.Text)
            For Each xMatch In xMatches
                xStr = Replace(xStr, xMatch.Value, "")
            Next
        xCell.Value = xStr
    Next
   Application.EnableEvents = True
End Sub

3. Still in the Microsoft Visual Basic for Applications window, please click Tools > References, check the Microsoft VBScript Regular Expression 5.5 option in the References-VBAProject dialog box, and then click the OK button.

4. Press the F5 key or click the Run button to run the code.

Then all html tags are removed from the whole worksheet immediately.


Office Tab - Tabbed Browsing, Editing, and Managing of Workbooks in Excel:

Office Tab brings the tabbed interface as seen in web browsers such as Google Chrome, Internet Explorer new versions and Firefox to Microsoft Excel. It will be a time-saving tool and irreplaceble in your work. See below demo:

Click for free trial of Office Tab!

Office Tab for Excel


Related articles:



Recommended Productivity Tools for Excel

Kutools for Excel Helps You Always Finish Work Ahead of Time, and Stand Out From Crowd

  • More than 300 powerful advanced features, designed for 1500 work scenarios, increasing productivity by 70%, give you more time to take care of family and enjoy life.
  • No longer need memorizing formulas and VBA codes, give your brain a rest from now on.
  • Become an Excel expert in 3 minutes, Complicated and repeated operations can be done in seconds, 
  • Reduce thousands of keyboard & mouse operations every day, say goodbye to occupational diseases now.
  • 110,000 highly effective people and 300+ world-renowned companies' choice.
  • 60-day full features free trial. 60-day money back guarantees. 2 years of free upgrade and support.

Brings Tabbed Browsing and Editing to Microsoft Office, Far More Powerful Than The Browser's Tabs

  • Office Tab is designed for Word, Excel, PowerPoint and Other Office Applications: 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!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Brian M · 1 months ago
    Thanks for that sub routine - just the job!