I am trying to write to a macro which remove html tags from excel data. I just want search for <*> this pattern and replace them with blank. Also need to remove special characters like '“'and tags like if(typeof(dstb)!= "undefined"){ dstb();}.
Code I have written till now requires me to hardcode files name in macro , which I do not want.
code :
Sub UnescapeCharacters()
sheetname = "2011 Publications" 'file name goes here
Dim sheet As Worksheet
Set sheet = Me.Worksheets(sheetname)
For Row = 1 To sheet.UsedRange.Rows.Count
For Column = 1 To sheet.UsedRange.Columns.Count
Dim cell As Range
Set cell = sheet.Cells(Row, Column)
ReplaceCharacter cell, """, """"
ReplaceCharacter cell, ",", ""
ReplaceCharacter cell, " ", ""
ReplaceCharacter cell, "•", ""
ReplaceCharacter cell, "</ul>", ""
ReplaceCharacter cell, "<ul>", ""
ReplaceCharacter cell, "<b>", ""
ReplaceCharacter cell, "</b>", ""
ReplaceCharacter cell, "<i>", ""
ReplaceCharacter cell, "</i>", ""
ReplaceCharacter cell, "</li>", ""
ReplaceCharacter cell, "<li>", ""
ReplaceCharacter cell, "</br>", ""
ReplaceCharacter cell, "<br />", ""
ReplaceCharacter cell, "</p>", ""
ReplaceCharacter cell, "<p>", ""
Next Column
Next Row
End Sub
Sub ReplaceCharacter(ByRef cell As Range, ByVal find As String, ByVal replacement As String)
Dim result As String
cell.Value = Replace(cell.Text, find, replacement, 1, -1)
End Sub
Can someone please help?