Removing HTML tags (specifically <p> tags)

furiousbob

New Member
Joined
Jul 2, 2015
Messages
2
Hi!


I'm new here. This would be my first post. I am in dire need of some help with removing HTML tags from a CSV file. I have about 3600 entries to modify. I used:


Code:
Sub RemoveTags()
Dim r As Range
Selection.NumberFormat = "@"  'set cells to text numberformat
With CreateObject("vbscript.regexp")
  .Pattern = "\<.*?\>"
  .Global = True
  For Each r In Selection
    r.Value = .Replace(r.Value, "")
  Next r
End With
End Sub

But that left me with about 880 entries with:

p class="MsoNormal" style="margin-bottom:0in;margin-bottom:.0001pt;line-height:normal"
<p class="MsoNormal" style="[/CODE]
p class=" msonormal"=""

(with < and > at the ends, not sure why I can't post it with the CODE tags)

I also tried find and replace using <*> for find and a empty replace field but I get the "Formula is too long" error message.


I'm pretty new to VBA so any help is appreciated!</p>
 
Last edited:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,214,822
Messages
6,121,767
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top