2

If you want to delete html tags in excel one way is to use the replace function. I search for "<*>" and replace it by "". So I just delete every html tag. Excel VBA also has a replace function but it is far more stupid. If I write:

temp2 = Replace(temp2, "<*>", "")

It doesn't interpret "< * >" as a regular expression. It only replace 1:1 the string "<*>". How can I use the replace function in VBA like I do in Excel?

3
  • possible duplicate of excel formula to strip html Commented Sep 2, 2015 at 10:36
  • There's also the ability to use regular expressions in vba. See stackoverflow.com/questions/22542834/… Commented Sep 2, 2015 at 10:42
  • 2
    If you would have recorded a macro, you would have got your answer... ;) Commented Sep 2, 2015 at 10:43

1 Answer 1

4

To search and replace all cells in the active sheet, you need to use something like:

Cells.Replace What:="<*>", Replacement:="", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False

Note that you can indicate the cell directly in the beginning: Cells(2,1). (to only replace in the A2 cell.

Sign up to request clarification or add additional context in comments.

2 Comments

yes thumb up ;) problem is my question is marked as dublicat but the other similiar question doesn't have your good answere ;)
Your question is not marked as a duplicate. At least at this moment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.