+ Reply to Thread
Results 1 to 7 of 7

How to delete multiple rows based off a value on another tab?

  1. #1
    Registered User
    Join Date
    10-28-2010
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    5

    Question How to delete multiple rows based off a value on another tab?

    I have attached a sample to make life easier and thank you in advance. I did look through the help and found lots of ways to delete rows but none referencing a value on another tab that changes. Most were based on static values, but i digress..

    I have a list of properties on a tab called "PropList" that have a unique number value in column A. I want to create a macro to delete all of the rows with values in column A that don't match the value that the user enters on the "Info" tab in cell "A4". But I don't want to ever delete the first 4 rows of data as it contains other information. The real report has thousands of rows and tens of columns of data and this will help prune and save file size.

    Thank you!!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: How to delete multiple rows based off a value on another tab?

    Hi

    Here goes.
    Please Login or Register  to view this content.
    rylo

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How to delete multiple rows based off a value on another tab?

    Hello mitchinphx,

    With that much data to check, you may want a faster macro. This macro first sorts the data using the values in column "A" and filters the column using the value from "A4" on the "Info" sheet. The filtered rows, if there are any, will then be deleted.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    10-28-2010
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to delete multiple rows based off a value on another tab?

    Thank you! But with that working I discovered a problem. The number on the info sheet displays as 03002 because of formatting, but it is actually read as 3002. So when the filter reads 3002 and doesn't find it in the prop list because there it is 03002 it deletes everything. Can a ltrim function where a 0 is added to the left if it is only 4 numbers be added somehow? There are property numbers that are 10000, 10001, etc. so i don't always need to add a 0.

    Thanks again,
    mitchinphx

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How to delete multiple rows based off a value on another tab?

    Hello mitchinphx,

    I have another way of doing this without using a filter that is still very fast. I am heading off to bed, but will pick this up in the morning.

  6. #6
    Registered User
    Join Date
    10-28-2010
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to delete multiple rows based off a value on another tab?

    thank you!

  7. #7
    Registered User
    Join Date
    10-28-2010
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: How to delete multiple rows based off a value on another tab?

    any more thoughts / assistance? i am still stuck... thanks again.

+ 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