Modifying vba code to stop infinite loop

  • Hi All,


    I have the code below where I am trying to find word "summary" in column A : last row (as defined below) and format it. Below code works fine however the do while does not stop and I am not sure how to end it once the last row has reached. I am not sure how to edit it so that it stops once the last row Is reached.


    Thanks Kaav06


  • Try:

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • I think the only change you need to make is move the firstaddress line outside the Do loop; otherwise it will change every time you find the search term. I've taken the opportunity to declare your variables and indent your code, both of which are good practice and help to spot errors. Your original code can't even have compiled as your End If and End With statements were the wrong way round.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!