+ Reply to Thread
Results 1 to 12 of 12

Delete rows outside the selected range

  1. #1
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Delete rows outside the selected range

    Hello,

    I posted this thread weeks ago and got the answer from a Forum Contributor for "Select rows with sum add up to 65% and color selected numbers in red".

    Now I need an expanded macro to (1) Do the same job for all sections (each section added up to 100%), (2) Delete all rows that are not selected (not highlighted in RED). Please see the attached for input data and desired outcome.

    I appreciate your help.
    Last edited by Ucpaul; 06-22-2013 at 02:31 PM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Delete rows outside the selected range

    check please your attachment
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Delete rows outside the selected range

    Please see attachment
    Attached Files Attached Files
    Last edited by Ucpaul; 06-22-2013 at 03:11 PM.

  4. #4
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Delete rows outside the selected range

    Any solution?

  5. #5
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Delete rows outside the selected range

    may be I can try if you explain better

  6. #6
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Delete rows outside the selected range

    More explanation:

    Column A consists of many names (rows in BLUE. I marked in that color so you can see easier. However, they have no color in my real spreadsheet).

    Within the section of each name, there are many items that add up to 100%. I want to keep all items that their sum <= 65% (chosen from the highest numbers to lowest), and delete all other items within the section of that name.
    For example, under row "1 Coronet Way", there are 6 item and sum up to 100%. I want to keep only 8:59-BL4 and 9:23-BL3 because their sum <=65%.

    Do the same for all other names.

  7. #7
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Delete rows outside the selected range

    Please Login or Register  to view this content.
    Last edited by patel45; 06-26-2013 at 02:54 AM.

  8. #8
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Delete rows outside the selected range

    Thanks very much for your help. It worked wonderful.

    Just a problem: when I added another section (5.Alabama - see the attached), it did not run it (I have hundred of sections and leaved only 4 sections in the attached to simplyfy it)
    Attached Files Attached Files

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,099

    Re: Delete rows outside the selected range

    Hi, Ucpaul,

    please try the code on the sample as well as on a copy of your original data to see if it works okay:
    Please Login or Register  to view this content.
    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

  10. #10
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Delete rows outside the selected range

    Thank you, Holger and Patel45, very much!!! It works perfectly and saves me so much time.

  11. #11
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Delete rows outside the selected range

    Quote Originally Posted by Ucpaul View Post
    Thanks very much for your help. It worked wonderful.

    Just a problem: when I added another section (5.Alabama - see the attached), it did not run it (I have hundred of sections and leaved only 4 sections in the attached to simplyfy it)
    need a change
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Delete rows outside the selected range

    Thank you, Patel45

+ 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