+ Reply to Thread
Results 1 to 5 of 5

Thread: delete rows

  1. #1
    Registered User
    Join Date
    03-01-2009
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    25

    delete rows

    i have an excel sheet say with more than 1000 rows
    i want to delete some rows based on certain condition say all rows which contain "AMERICA" in second column

    can i do it with a macro

  2. #2
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,134

    Re: delete rows

    Use AutoFilter to select rows containing America, select all rows, delete.
    Last edited by shg; 09-27-2009 at 01:46 AM.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    03-01-2009
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: delete rows

    not this action only , i want to include this action in another macro,

  4. #4
    Registered User
    Join Date
    03-01-2009
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: delete rows

    Sub dele()
    Range("b2").Select
    Do Until Selection.Value = ""
    If Selection.Value = "xxx" Then
    Selection.EntireRow.Delete
    Else
    Selection.Offset(1, 0).Select
    End If
    Loop

    Range("A1").Select

    End Sub

    i got the macro , but how to do the below

    If Selection.Value not = "xxx" Then ( i have included not here)

    i want to have the syntax for the above

  5. #5
    Forum Moderator DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Suffolk, UK
    MS-Off Ver
    2002, 2007 & 2010
    Posts
    21,379

    Re: delete rows

    np1966,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    Please edit your prior post per the above.

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.2.0