Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Find - Replace...for worksheets

  1. #1
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Newcastle, UK
    Posts
    1,174
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    is there a way to Find Replace worksheet names using VB?
    i.e. I have 7 sheets called AgentOld + Day of the week. agent1 leaves and a new person joins th team I'd like a quick way to Find AgentNew and relace with AgentNew

    Thanks in advance,
    "Have a good time......all the time"
    Ian Mac

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Ian

    With only 7 sheets why not just rename in manually?



  3. #3
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Newcastle, UK
    Posts
    1,174
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi dave,

    I would BUT 7 sheets for 1 person, 15 people per team, 35 teams on site.
    They all constantly change. I was hoping for a piece of code that would help me with this ardious task.

    Thanks
    "Have a good time......all the time"
    Ian Mac

  4. #4
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-08 08:55, Ian Mac wrote:
    Hi dave,

    I would BUT 7 sheets for 1 person, 15 people per team, 35 teams on site.
    They all constantly change. I was hoping for a piece of code that would help me with this ardious task.

    Thanks
    Hi,


    Try something like the following. I assume that you have a way to identify the AgentOld and AgentNew strings already in place.

    Change the ThisWorkbook reference to the worksheet(s) to cycle through workbooks (can be done in code as well).

    ---------------------
    Sub test()

    Dim ws As Worksheet

    For Each ws In ThisWorkbook.Worksheets
    ws.Activate
    Cells.Replace What:=AgentOld, Replacement:=AgentNew, LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False
    Next ws

    End Sub
    --------------------------

    HTH,
    Jay

  5. #5
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Ian

    Ok, now I understand!

    The easiest way would be via a very simple UserForm that could be activte via a Button. I have such a form with code that you could use just email me if you are interested and I will send you a copy.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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