+ Reply to Thread
Results 1 to 7 of 7

Deleting rows on reverse order using For Next loop

  1. #1
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Deleting rows on reverse order using For Next loop

    Hi experts and gurus,

    I have got the data which I want to delete on reverse order using For / Next Loop. The sample data are as under:

    January
    February
    March
    April
    May
    June
    July
    August
    September
    October
    November
    December
    January
    February
    March
    April

    The delete operation should stop once it reaches to "December". I wrote the following code, which keeps on deleting even after it finds the word "December".

    Please Login or Register  to view this content.
    I appreciate any guidance to stop the operation when the loop finds the text "December". Also I would welcome suggestion on finding "December" and then deleting all the rows thereafter.

    Thank you
    Roshan Shakya
    Last edited by Roshan.Shakya; 09-12-2019 at 03:41 PM. Reason: spelling correction

  2. #2
    Valued Forum Contributor
    Join Date
    06-02-2012
    Location
    London, England
    MS-Off Ver
    365
    Posts
    397

    Re: Deleting rows on reverse order using For Next loop

    Maybe this?
    Please Login or Register  to view this content.
    Beth.

  3. #3
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Deleting rows on reverse order using For Next loop

    Hi you may
    Please Login or Register  to view this content.
    Last edited by mohadin; 09-12-2019 at 04:34 PM.

  4. #4
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Re: Deleting rows on reverse order using For Next loop

    Both of you were excellent.

    I appreciate your codes.

    Thank you
    Roshan Shakya

  5. #5
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Deleting rows on reverse order using For Next loop

    you are well come
    Be happy

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Deleting rows on reverse order using For Next loop

    You are happy with the suggestions but I would change this
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.
    just in case you will be close to the last row (very unlikely) of the sheet.

    Or you could use a single line like this
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    176

    Re: Deleting rows on reverse order using For Next loop

    Thanks jolivanes for the code.

    Roshan Shakya

+ 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. Keep linked cells in order after deleting rows
    By Beeblebrox in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-22-2015, 03:41 PM
  2. [SOLVED] Deleting rows in a loop
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2012, 03:39 PM
  3. [SOLVED] Vlookup formula in a reverse order loop
    By JMaug in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-01-2012, 10:48 PM
  4. [SOLVED] Macro to Reverse Order of Columns but Dependent on Number of Data Rows
    By francois28 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2012, 06:34 PM
  5. Loop for Deleting Rows
    By Sharky Amit in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-20-2009, 05:50 AM
  6. Deleting rows loop
    By briskbaby in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-07-2005, 04:10 PM
  7. How to reverse order of rows and columns
    By Johnny in forum Excel General
    Replies: 3
    Last Post: 09-11-2005, 11:05 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