+ Reply to Thread
Results 1 to 7 of 7

Find and Replace VBA code not working

  1. #1
    Registered User
    Join Date
    07-15-2015
    Location
    new hampshire
    MS-Off Ver
    Office 2010
    Posts
    83

    Find and Replace VBA code not working

    I am trying to find all no border cells, and replace them with thick box borders.
    When I used the find and replace, it replaced some but not all, hence the 5 additional macros added to border what "find and replace" did not perform.

    Then, I combined all of the code into one "RunREPLACEGRIDSMacros".

    How can I have just one macro that does it all?
    Is there something in the cell formatting that would keep the standard "find and replace" (no border cells to thick box borders) from working?
    And finally, what is wrong with the code below that I have as a part of "RunREPLACEGRIDSMacros"?
    Please Login or Register  to view this content.
    Thank you!
    Last edited by Leith Ross; 06-08-2017 at 12:30 AM. Reason: Added Code Tags

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Find and Replace VBA code not working

    I am not sure what you are trying to do here. The code makes no sense at all. You select ranges but immediately activate a single cell and then scroll down from this "fixed" cell. The first 3 lines of code can be replaced with Range("T73").Activate. But you can throw that away, because you then select another range, only to ignore it by activating another single cell. As for the Replacement, it looks like you are trying to replace the null string with the null string.

    Replace replaces parts of strings. If you want to draw borders you need to use the various border commands (which I can never remember so I record a macro to get the syntax).

    Let's back up and look at the big picture, there may be a better way of doing this. Explain where the data for this sheet comes from, how it is entered, how you intend to use it. There are many ways of doing things in Excel. Often the best way of doing it depends on the context.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    07-15-2015
    Location
    new hampshire
    MS-Off Ver
    Office 2010
    Posts
    83

    Re: Find and Replace VBA code not working

    Hi,
    I am trying to replace the thick box border in all cells.

    The context is that some of the recipients of this document prefer them and some do not.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Find and Replace VBA code not working

    Why not just create the sheet with the borders the way you want them?

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Find and Replace VBA code not working

    Something like this? :

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  6. #6
    Registered User
    Join Date
    07-15-2015
    Location
    new hampshire
    MS-Off Ver
    Office 2010
    Posts
    83

    Re: Find and Replace VBA code not working

    I did, but some of the stackholders want the borders, some do not, so I want an option to add and take away without having to do each row, column, cell, etc.

  7. #7
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Find and Replace VBA code not working

    This code should outline the specified ranges on the Map Tab with a thick border.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Find/Replace not working?
    By forestavekids in forum Excel General
    Replies: 1
    Last Post: 03-09-2017, 10:53 PM
  2. Find and Replace Not Working
    By BADebbie in forum Excel General
    Replies: 13
    Last Post: 06-07-2016, 12:50 PM
  3. Find and replace not working
    By ammartino44 in forum Excel General
    Replies: 4
    Last Post: 08-25-2015, 12:36 PM
  4. VBA Find-Replace Not Working
    By 13gentj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2015, 08:18 PM
  5. Find Replace Not Working
    By FieldHaven in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-15-2014, 03:43 AM
  6. [SOLVED] Find & Replace Not Working in VBA
    By jazzy1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-16-2012, 06:18 PM
  7. Replies: 7
    Last Post: 03-03-2008, 11:48 AM

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