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.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
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.
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.