+ Reply to Thread
Results 1 to 7 of 7

How to delete blocks of rows in Excel

  1. #1
    Registered User
    Join Date
    01-16-2013
    Location
    Matlock England
    MS-Off Ver
    Excel 2003
    Posts
    4

    How to delete blocks of rows in Excel

    I have a very large spreadsheet of Excel 2007. I want to delete 5 rows in every 6. over a total of approx 1000 rows. i.e. discard 5/6 of information. I have found the macro to delete alternate rows, but my programming skill is nil! Any ideas please?

  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: How to delete blocks of rows in Excel

    Is there any condition based on which the row should be deleted?
    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
    Registered User
    Join Date
    01-16-2013
    Location
    Matlock England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: How to delete blocks of rows in Excel

    Rows down are intervals of 10 minutes from a data logger. I only want to analyse results for each hour. So I want to retain rows 6, 12, 18 etc.
    Many thanks
    Al.
    Last edited by Baytreeal; 01-16-2013 at 10:42 AM.

  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: How to delete blocks of rows in Excel

    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 Tools | Macro | Macros
    Select a macro in the list, and click the Run button

  5. #5
    Registered User
    Join Date
    01-16-2013
    Location
    Matlock England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: How to delete blocks of rows in Excel

    I understand the procedure, and posted your code into a module. However, when I run the macro, I get the message Run-time error '9'; Subscript out of range. The debugger highlights the line 'With Worksheets ("Sheet1")'
    Many thanks for your continued help.
    Best wishes
    Al

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

    Re: How to delete blocks of rows in Excel

    Is the sheet containing the data called "Sheet1" ? If not, edit the code to reflect the name of your sheet.

  7. #7
    Registered User
    Join Date
    01-16-2013
    Location
    Matlock England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: How to delete blocks of rows in Excel

    Problem solved - that's saved me many hours of work ! Thank you !!
    Best wishes
    Al

+ 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