For Loop Goes Into An Infinite Loop

  • My code below goes into an infinite loop, with culprit line shown in bold and underline. Please help identify error in my code logic. Thank you


  • Re: For Loop Goes Into An Infinite Loop


    This doesn't lookright to me

    Code
    For ColIndex = 1 To Range(ActiveCell, ActiveCell.EntireRow.Cells(1, Columns.Count).End(xlToLeft)).Columns.Count


    What is it supposed to count?

  • Re: For Loop Goes Into An Infinite Loop


    You should not be decrementing a loop variable with code.


    Also when deleting anything you should go from bottom to top, or right to left.

    Boo!:yikes:

Participate now!

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