VBA & Macro Problems

How to Find and Replace Large HTML Blocks in Excel Cells

Algirdas JasaitisAlgirdas Jasaitis Oct 28, 2026 871 views

Question details

The user needs to remove identical large sections of HTML code across hundreds of rows in Excel cells while keeping a specific portion intact.

How to Find and Replace Large HTML Blocks in Excel Cells
Product
Microsoft Excel
Device & OS
not provided
Scenario
Performing bulk edits on large HTML strings stored inside spreadsheet cells to extract and retain only the necessary information.
Observed behavior
Using standard find and replace is difficult for extracting complex HTML, often requiring tested wildcards, text formulas, or VBA scripts to preserve specific sections safely.
Before you start

Always create a backup copy of your Excel workbook before running bulk find and replace operations or executing VBA macros, as these actions can permanently alter your data.

Solution 1Recommended

Use Advanced Wildcards in Find and Replace

Utilize Excel's built-in Find and Replace feature with wildcard characters to target and remove large blocks of unwanted HTML code.

Excel allows the use of wildcards like the asterisk (*) to represent any string of characters. This can be used to capture variable HTML tags or long blocks of code surrounding the text you want to keep.

1
Open Find and Replace

Press Ctrl + H on your keyboard to open the Find and Replace dialog box.

2
Enter the wildcard pattern

In the 'Find what' box, type your wildcard pattern. For example, to remove everything before your specific text, you might type '*<specific_tag>'. Be extremely precise to avoid deleting wanted data.

3
Set Replace parameter

Leave the 'Replace with' box completely empty if you want to delete the matching HTML content.

4
Test and replace

Click 'Find Next' a few times to test exactly what Excel is targeting. Once you confirm it is highlighting only the unwanted HTML, click 'Replace All'.

Use Advanced Wildcards in Find and Replace
Wildcard Limitations: Excel's wildcard replacement is basic and greedy. It may not reliably extract highly complex nested HTML structures without accidentally deleting the text you intend to preserve.
Advanced Data Management

Manage Large Datasets and HTML Strings Easily with WPS Spreadsheet

WPS Spreadsheet offers powerful data processing capabilities, full compatibility with Microsoft Excel formats, and robust support for formulas and VBA macros, making it easy to clean and manipulate large HTML blocks in your cells.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the file containing the complex HTML data.
  2. 2. Access Find and Replace: Press Ctrl + H to open the Find and Replace dialog and use the Options button to enable advanced wildcard targeting.
  3. 3. Use advanced tools: Execute custom text extraction formulas or seamlessly run VBA scripts within the WPS environment to parse your HTML perfectly.
Seamless compatibility with Microsoft Excel (.xlsx, .xls) and macro-enabled workbooks (.xlsm).Free, lightweight, and fast performance even when processing hundreds of rows of complex data.Built-in support for advanced Find & Replace wildcards and powerful text extraction formulas.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't standard Find and Replace work well for HTML code in Excel?

Standard Find and Replace looks for exact string matches. Because HTML code often contains variable attributes, nested tags, and line breaks, simple matching usually fails or deletes unintended text. Advanced wildcards or formulas are typically required.

What wildcard characters can I use in Excel's Find and Replace?

Excel supports the asterisk (*) to represent any number of characters and the question mark (?) to represent a single character. You can use these to target variable blocks of text between specific HTML tags.

Can I use Regular Expressions (Regex) directly in Excel without VBA?

No, Excel does not natively support Regular Expressions in its standard Find and Replace dialog or through standard formulas. To use Regex for complex HTML parsing, you must utilize a VBA macro.

How do I safely test my HTML replacement pattern?

Always test your pattern on a duplicate worksheet. In the Find and Replace dialog, use the 'Find Next' button instead of 'Replace All' to step through the matches individually, ensuring only the unwanted HTML is targeted.