Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

in the excel, I have data like

Series_post
Series_get

I want to find and replace it to

<Series_post>
<Series_get>

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
add comment

2 Answers 2

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
            Do
                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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.