+ Reply to Thread
Results 1 to 8 of 8

For Each loop doesn't take every row into account

  1. #1
    Registered User
    Join Date
    11-29-2010
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    87

    Question For Each loop doesn't take every row into account

    Hi

    I'm working on a macro in which I want it to delete every row in which the value of the cell in column A matches the value of fixed cell "I1".

    Partially my code works, however it doesn't take every cell in the range in to account. It skips every other row.

    Can anyone of you guys pls help me out with this one?

    Greetz,
    Tino

    Code used:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Cutter; 10-15-2012 at 01:13 PM. Reason: Added code tags

  2. #2
    Forum Contributor
    Join Date
    09-05-2012
    Location
    It's more fun in the Philippines :D
    MS-Off Ver
    Excel 2007
    Posts
    209

    Re: For Each loop doesn't take every row into account

    @tino

    please see attached.
    Attached Files Attached Files
    Don't forget to mark your thread as [SOLVED].

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: For Each loop doesn't take every row into account

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: For Each loop doesn't take every row into account

    value of fixed cell "I1". I can not see this value in I1

  5. #5
    Registered User
    Join Date
    11-29-2010
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    87

    Re: For Each loop doesn't take every row into account

    Ok Joseph, I knew I had to do something with the code but didn't know exactly what anymore.

    I'm sorry, this won't happen again.

    Greetz,
    Tino

  6. #6
    Registered User
    Join Date
    11-29-2010
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    87

    Re: For Each loop doesn't take every row into account

    Quote Originally Posted by thisisgerald View Post
    @tino

    please see attached.
    Hi,

    Thank you very much for your quick reply, this is exactly what I was looking for.

    Greetz,
    Tino

  7. #7
    Registered User
    Join Date
    11-29-2010
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    87

    Re: For Each loop doesn't take every row into account

    Hi

    Just to complete this. I got this to work just fine for me using a do...loop.

    The code I used replacing the For each loop is:

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    09-05-2012
    Location
    It's more fun in the Philippines :D
    MS-Off Ver
    Excel 2007
    Posts
    209

    Re: For Each loop doesn't take every row into account

    Quote Originally Posted by Tino XXL View Post
    Hi

    Just to complete this. I got this to work just fine for me using a do...loop.

    The code I used replacing the For each loop is:

    Please Login or Register  to view this content.
    Yes, basically this one will also works.

    Regards,
    thisisgerald

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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