+ Reply to Thread
Results 1 to 4 of 4

Replacing values on multiple sheets using a macro

Hybrid View

Guest Replacing values on multiple... 10-19-2005, 05:05 PM
Guest RE: Replacing values on... 10-19-2005, 06:05 PM
Guest Re: Replacing values on... 10-19-2005, 06:05 PM
Guest Re: Replacing values on... 10-19-2005, 06:05 PM
  1. #1
    psoftguy
    Guest

    Replacing values on multiple sheets using a macro

    Hi,
    Here's what I need to do: select all sheets in a workbook and do a
    replace of "\=" with "=" on each of these sheets. I can do it manually,
    but I have no exposure to VBA and am having troubles coding it. To do
    it manually- right click on the name of the worksheet - a menu will pop
    up. Click on "Select Al Sheets". Now, when you select "Find" or
    "Replace" from the Edit menu in Excel, all worksheets in your workbook
    will be searched.

    Any help would be really appreciated!!!

    Thanks!


  2. #2
    Jim Thomlinson
    Guest

    RE: Replacing values on multiple sheets using a macro

    Give this a try...

    Sub DoStuff()
    Dim wks As Worksheet

    For Each wks In Worksheets
    wks.Cells.Replace "\=", "="
    Next wks
    End Sub

    --
    HTH...

    Jim Thomlinson


    "psoftguy" wrote:

    > Hi,
    > Here's what I need to do: select all sheets in a workbook and do a
    > replace of "\=" with "=" on each of these sheets. I can do it manually,
    > but I have no exposure to VBA and am having troubles coding it. To do
    > it manually- right click on the name of the worksheet - a menu will pop
    > up. Click on "Select Al Sheets". Now, when you select "Find" or
    > "Replace" from the Edit menu in Excel, all worksheets in your workbook
    > will be searched.
    >
    > Any help would be really appreciated!!!
    >
    > Thanks!
    >
    >


  3. #3
    psoftguy
    Guest

    Re: Replacing values on multiple sheets using a macro

    Awesome! It works! Thanks a lot, Jim!


  4. #4
    nisgore
    Guest

    Re: Replacing values on multiple sheets using a macro

    This little bit of code should help you, but you'll have a little bit
    of customizing to do before it'll probably work on your computer.
    Aside from placing the code into a macro, the only thing you will have
    to do is replace the sheet names ("Sheet1", "Sheet 2", etc...) with the
    actual name of your sheets. It works best if you double click on the
    sheet name, then copy and paste it into this, because sometimes there
    is a space that's not visible in the sheet name that will prevent the
    code from running. You can put as many sheet names as you like as long
    as they are in your workbook, just make sure to put quotes around them
    and separate them with commas. Good luck.

    Sub SearchReplaceWorkbook()
    Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
    Sheets("Sheet1").Activate
    Cells.REplace What:="\=", Replacement:="=", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, _
    SearchFormat:=False, ReplaceFormat:=False
    End Sub


+ 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