+ Reply to Thread
Results 1 to 5 of 5

Replacing specific text in cell

  1. #1
    Registered User
    Join Date
    05-21-2012
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    14

    Replacing specific text in cell

    Hello,
    I created the macro below, but I need the -T to replace the -L. As of right now, it does not replace, it only adds on the -T after the -L. Any Ideas on how to do this?

    Sub option1()
    Call Sheet3.MakeTextFile
    Call Sheet4.MakeTextFile
    Call Sheet5.MakeTextFile

    [A9].Value = [A9].Value & "-L"
    [E9].Value = [E9].Value & "-L"

    Call Sheet3.MakeTextFile
    Call Sheet4.MakeTextFile
    Call Sheet5.MakeTextFile

    [A9].Value = [A9].Value & "-T"
    [E9].Value = [E9].Value & "-T"

    Call Sheet3.MakeTextFile
    Call Sheet4.MakeTextFile
    Call Sheet5.MakeTextFile
    End Sub

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Replacing specific text in cell

    Have you try the replace function? Rows(1).Replace("-L","-T")

  3. #3
    Registered User
    Join Date
    05-21-2012
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Replacing specific text in cell

    I just tried that, but I could not get it to work.

  4. #4
    Registered User
    Join Date
    05-21-2012
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Replacing specific text in cell

    I tried to do this:

    Sub option1()
    Call Sheet3.MakeTextFile
    Call Sheet4.MakeTextFile
    Call Sheet5.MakeTextFile

    [A9].Value = [A9].Value & "-L"
    [E9].Value = [E9].Value & "-L"

    Call Sheet3.MakeTextFile
    Call Sheet4.MakeTextFile
    Call Sheet5.MakeTextFile

    [A9].Value = [A9].Replace("-L", "-T")
    [E9].Value = [E9].Replace("-L", "-T")

    Call Sheet3.MakeTextFile
    Call Sheet4.MakeTextFile
    Call Sheet5.MakeTextFile
    End Sub

  5. #5
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Replacing specific text in cell

    Can you post a sample file.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1