+ Reply to Thread
Results 1 to 4 of 4

Delete every nth rows which is dependent on total number of rows

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    Delete every nth rows which is dependent on total number of rows

    From a single sheet, I am trying to delete a certain block of rows, which is dependent on the total number of rows and leave a sample of ~ 100 rows of data. For example, if I have a sheet with 1000 rows of data, I want delete every row except rows 10, 20, 30, 40, 50, 60, 70, 80...etc (leaves ~100 rows). If I have a sheet with 300 rows of data, I want to delete every row except rows 3, 6, 9, 12, 15...etc.

    I've been searching various forums but I can't find anything similar that would accomplish this task. Any comments appreciated. Thanks.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Delete every nth rows which is dependent on total number of rows

    Is it always a constant of 100 rows that you require?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,173

    Re: Delete every nth rows which is dependent on total number of rows

    Yes, as close to 100 as possible plus or minus 5 or so. Thanks

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Delete every nth rows which is dependent on total number of rows

    Try this code
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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