+ Reply to Thread
Results 1 to 2 of 2

Find and Replace Loop does not find all and loop properly

  1. #1
    Registered User
    Join Date
    07-12-2015
    Location
    Melbourne,Australia
    MS-Off Ver
    2007
    Posts
    14

    Find and Replace Loop does not find all and loop properly

    Hi,

    The below code is meant to find special characters and replace them. I am using it in a worksheet that has ~300 rows and columns A-X.

    It seems to pick up some special characters and replace them but not all of them? If I run the macro again it will find more but again not all, and basically I have to keep running and manually check until it finds them all. Yet it does not report any errors? Please help I can't figure this one out.

    Please Login or Register  to view this content.
    Thanks,
    Mattyfaz

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Find and Replace Loop does not find all and loop properly

    Your structure is a little unusual, at least to me.
    Please Login or Register  to view this content.
    I don't know why you would even use this. You would specify this range as the range that range.find would search and that would be all you need. So I would get rid of this loop. You then have a do loop outside of your for x loop which also is a little strange. I would remove the do loop and then I would structure the code as follows.

    You only need to loop through your findList one time. Instead of using just range.find use range.find followed by find next and loop the find next until it equals nothing and then loop x and do it again. That way you are looking for all the first characters in your array list until it finds no more then the second and so on. Also when you use find next, if you code it correctly it starts where you left off, it just continues from there looking for another match. You check if it's nothing if it is you exit the find next loop and go to the next x until your array has been looped through and you are done.

    Good Luck.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

+ 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. [SOLVED] Loop - Find and Replace
    By ELeGault in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-10-2015, 06:45 PM
  2. Find & Replace Loop Help Needed
    By bryanmarks in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-29-2014, 10:19 AM
  3. [SOLVED] Find String Loop not Terminating Properly
    By Doug Nguyen in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-18-2014, 11:02 AM
  4. VBA Find and replace loop help needed
    By susanbarbour in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-13-2012, 08:43 AM
  5. Excel 2007 : Find and replace loop
    By chrisrabkin in forum Excel General
    Replies: 1
    Last Post: 10-18-2011, 05:58 PM
  6. Find and replace Loop Error
    By fengfeng in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2009, 03:57 PM
  7. [SOLVED] Find & Replace / Loop & Vlookup
    By thom hoyle in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-24-2005, 08:05 PM

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