Closed Thread
Results 1 to 10 of 10

Automatically remove unwanted rows

  1. #1
    Registered User
    Join Date
    12-13-2007
    Posts
    3

    Exclamation Automatically remove unwanted rows

    Hi all,

    Im not strong in excel, that why Im here. So:
    I work every day with big amount of item numbers and lists in excel and I need some macro or code to automatically remove rows, containing unwanted text.

    Example:

    MEMORY DIMM 512MB PC3200 DDR
    MEMORY DIMM 512MB PC6400 DDRII
    MEMORY DRIVE FLASH USB2 2GB
    MEMORY MINI SD 2GB W/ADAPTER
    MEMORY SECURE DIGITAL 2GB
    MEMORY DIMM 1GB PC6400 DDRII
    MEMORY DRIVE FLASH USB2 1GB
    MEMORY DRIVE FLASH USB2 1GB

    So I paste the text from my database, and want to automatically delete rows containing DIMM string. How can I do it?

    p.s. is there also a way to leave only the rows I want?

  2. #2
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi,

    Put this code in a VB module, select for example column A (rows that contains the word "DIMM"), then go to Tools->Macro, then select macro named "deleteRows", click run.

    Please Login or Register  to view this content.
    Last edited by corinereyes; 12-13-2007 at 12:53 PM.
    Corine

  3. #3
    Registered User
    Join Date
    12-13-2007
    Posts
    3
    but this will delete only the whole words DIMM or also the words, containing DIMM? i have tried, and still all the DIMMS are in my sheet.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try using the Forum search. My code here the can be changed to do what you want.

    http://www.excelforum.com/showthread...ighlight=union
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    12-13-2007
    Posts
    3
    gives me "Compile Error: Expected End Sub"

    what that means?

  6. #6
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Quote Originally Posted by xlsior
    but this will delete only the whole words DIMM or also the words, containing DIMM? i have tried, and still all the DIMMS are in my sheet.
    select column A first then run the macro. the code deletes the row that contains the word "DIMM" on it. try the attached sheet.

    Hope that helps.
    Attached Files Attached Files

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by xlsior
    gives me "Compile Error: Expected End Sub"

    what that means?
    You haven't copied the code correctly, you have missed the End Sub line

  8. #8
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Quote Originally Posted by xlsior
    gives me "Compile Error: Expected End Sub"

    what that means?
    with RoyUk's code maybe you didnt able to copy the "End Sub" at the bottom of the code, try typing "End Sub" at the bottom of the code in the macro module.

  9. #9
    Registered User
    Join Date
    01-04-2010
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Automatically remove unwanted rows

    Hi!

    Can anyone help me with the solution to this problem?
    I want to auto delete the entire row under the column of time with a specific time of 12am to 7am of the next day. I want it to be auto updated from day to day. The only time I need to retain is from 8am until 11pm with its containing row. Appreciate your kind assistance.

    12:00:00 AM
    1:00:00 AM
    2:00:00 AM
    3:00:00 AM
    4:00:00 AM
    5:00:00 AM
    6:00:00 AM
    7:00:00 AM
    8:00:00 AM
    9:00:00 AM
    10:00:00 AM
    11:00:00 AM
    12:00:00 PM
    1:00:00 PM
    2:00:00 PM
    3:00:00 PM
    4:00:00 PM
    5:00:00 PM
    6:00:00 PM
    7:00:00 PM
    8:00:00 PM
    9:00:00 PM
    10:00:00 PM
    11:00:00 PM
    12:00:00 AM
    Attached Files Attached Files

  10. #10
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Automatically remove unwanted rows

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

Closed 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