Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

in the excel, I have data like


I want to find and replace it to


I tried

find: Series*
replace: <Series*>

But it doesn't really work. It can find the cells, but replace them with <Series*> all the time.

share|improve this question
Not with standard functionality. Is vba an option? – glh May 14 '13 at 7:33
up vote 0 down vote accepted

That type of replace is not a standard functionality in Excel but is do able using VBA:

Sub wrap_in_tag()

    With ActiveSheet.Cells

        Dim c As Variant, firstAddress As String, sFind As String

        sFind = InputBox("Enter search critera, e.g. Series* will result <Series_test>:" _
        , "Enter Critera")

        If sFind = "" Then Exit Sub

        Set c = .Find(sFind, LookAt:=xlWhole)

        If Not c Is Nothing Then
            firstAddress = c.Address
                c.Value = "<" & c & ">"
                Set c = .Find(sFind, LookAt:=xlWhole)
            Loop While Not c Is Nothing
        End If
    End With
End Sub
share|improve this answer
thanks for this answer. can you edit this script so that all highlighted cells will add <> to them? sorry I am very new to VBA script. – Pat May 14 '13 at 16:04

Your best bet may be to replace Se by <Se and also t by t>.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .