+ Reply to Thread
Results 1 to 7 of 7

Deleting rows based on criteria.

  1. #1
    Registered User
    Join Date
    08-05-2009
    Location
    Ballarat Australia
    MS-Off Ver
    Excel 2007
    Posts
    65

    Deleting rows based on criteria.

    Hi all,

    Just wondering if I can get some help on the code attached.

    It works fine as far as finding & deleting required line, one line at a time, but I can't work out how to get it to loop through the whole sheet.


    any help would be appreciated


    HTML Code: 
    Attached Files Attached Files
    Last edited by nighttrainrex; 10-09-2013 at 12:49 AM. Reason: Change thread title

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Help to Loop

    Hi, nighttrainrex,

    you could use the Autofilter for this as well.

    Command would be FindNext after the first found. Assign the address of the first range for find to a string and use a Do...Loop to run FindNext, compare the address of the new Find with the first one.

    There is no need to select the rnage before deleteing.

    And maybe you should consider changing the thread title.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Deleting rows based on criteria.

    Try this code...

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    08-05-2009
    Location
    Ballarat Australia
    MS-Off Ver
    Excel 2007
    Posts
    65

    Re: Help to Loop

    Hi Holger,

    Thanks for the quick reply title changed.

    I have very little knowledge with this, the code I have I have pieced together from ones I found on here.

    I get the bit about not selecting the range but am lost when it comes to the loop & find next bits.

    Rex

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Deleting rows based on criteria.

    Hi,m Rex,

    I still stand for Autofilter to be the faster way to get the problem solved. Here youŽll find an example and right below arlu1201 has posted a code for using Autofilter.

    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    08-05-2009
    Location
    Ballarat Australia
    MS-Off Ver
    Excel 2007
    Posts
    65

    Re: Deleting rows based on criteria.

    Hi Sixthsense,

    Thanks that worked a treat.

    Appreciate the help.

  7. #7
    Registered User
    Join Date
    08-05-2009
    Location
    Ballarat Australia
    MS-Off Ver
    Excel 2007
    Posts
    65

    Re: Deleting rows based on criteria.

    Thanks Holger,

    I will have a look at the post.

    As I am learning (fumbling) my way along all the help/info I can pick up is fantastic.

+ 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] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  2. Why did an inner loop variable start overwriting the outer loop range suddenly?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2012, 03:24 PM
  3. Macro Loop Broken. Detects Max but doesn't continue loop
    By herchenbach in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2011, 12:17 PM
  4. Replies: 0
    Last Post: 07-20-2010, 11:42 AM
  5. Loop a column on Sheet1 and loop a row on Sheet2 to find a match
    By johnnywinter in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-13-2009, 02:09 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