+ Reply to Thread
Results 1 to 6 of 6

Loop with two statements

  1. #1
    Forum Contributor
    Join Date
    02-23-2015
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    109

    Loop with two statements

    Hello everyone!

    I have got a excel file that looks the one below:

    https://i.imgur.com/erW3inj.png

    Now I need a loop that check each cell in Column "H", if there is two cells in column "H" that matches each other (in this case Cell 1 and Cell 6).
    Check in Column "i" if there is any data in any of these cells, remove the cell that have no data in Column "i".See result result below:

    https://i.imgur.com/MnaTwLe.png

    Could someone help me with this?

    Thank you in advance

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,615

    Re: Loop with two statements

    You don't really need VBA. You could add a Helper column with a COUNTIF formula against column H. Filter the Helper column on >1 and the other column on blanks. Delete visible rows.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    02-23-2015
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    109

    Re: Loop with two statements

    I have already a VBA macro I need to implement the loop inside.

    That's why it need to be VBA.
    Last edited by elmnas; 10-25-2016 at 06:15 AM. Reason: To clarify.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,615

    Re: Loop with two statements

    Ok, but rather than loop, add the Helper column in code and filter and delete in code

  5. #5
    Forum Contributor
    Join Date
    02-23-2015
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    109

    Re: Loop with two statements

    Hi @TMS,

    Could you please help me with a code snippet for this?

    Thank you a lot in advance.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Loop with two statements

    FWIW:

    Please Login or Register  to view this content.

+ 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. Replies: 1
    Last Post: 01-09-2016, 06:04 PM
  2. [SOLVED] For loop with mulitple if statements.
    By Petter120 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-03-2014, 02:31 PM
  3. Repeat or Loop VBA Statements
    By zede35 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-03-2014, 03:19 AM
  4. Scrape XML with loop and if-then statements
    By bszen27 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-21-2012, 02:03 PM
  5. Replies: 6
    Last Post: 08-04-2011, 11:27 AM
  6. VBA Syntax to loop and do if then else statements
    By 1234567890 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-19-2011, 10:39 PM
  7. VBA Do...Loop Statements
    By liseladele in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-24-2006, 06:57 AM

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