+ Reply to Thread
Results 1 to 10 of 10

Delete 10 rows when cell starts with 3 letters "COG"

  1. #1
    Forum Contributor
    Join Date
    11-25-2011
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    107

    Delete 10 rows when cell starts with 3 letters "COG"

    I need a macro that will locate cell that starts with "COG" (3 letters)
    Once that's located I need to delete that row and 10 rows under that.

    Thank you
    Last edited by jimstrongy; 02-13-2012 at 10:52 PM.

  2. #2
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Delete 10 rows when cell starts with 3 letters "COG"

    try this it works with column A
    Please Login or Register  to view this content.
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Delete 10 rows when cell starts with 3 letters "COG"

    Hi jimstrongy

    Not tested but you might try this
    Please Login or Register  to view this content.
    Never mind...didn't refresh the screen
    Last edited by jaslake; 02-11-2012 at 07:42 PM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Contributor
    Join Date
    11-25-2011
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    107

    Re: Delete 10 rows when cell starts with 3 letters "COG"

    Quote Originally Posted by tom1977 View Post
    try this it works with column A
    Please Login or Register  to view this content.
    Tom this would work perfect if it deletes the whole 10 rows but it only deletes 10 cells under the cell that start with "COG".
    Also column where this cell is changes constantly, is there any way to open the range to multiple columns rather than just one column.

    Thanks

  5. #5
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Delete 10 rows when cell starts with 3 letters "COG"

    to delete rows use this
    Please Login or Register  to view this content.
    What is your range where code should find COG text?

  6. #6
    Forum Contributor
    Join Date
    11-25-2011
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    107

    Re: Delete 10 rows when cell starts with 3 letters "COG"

    Quote Originally Posted by tom1977 View Post
    to delete rows use this
    Please Login or Register  to view this content.
    What is your range where code should find COG text?
    Range is column A to column P

  7. #7
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Delete 10 rows when cell starts with 3 letters "COG"

    try this
    Please Login or Register  to view this content.

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Delete 10 rows when cell starts with 3 letters "COG"

    this suffices:

    Please Login or Register  to view this content.



  9. #9
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Delete 10 rows when cell starts with 3 letters "COG"

    snb

    this suffices:

    sub snb()
    cells.find("COG",,xlvalues,xlpart).resize(11).entirerow.delete
    end sub
    for one “COG” ok, but two or more occurrences?

  10. #10
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Delete 10 rows when cell starts with 3 letters "COG"

    Please Login or Register  to view this content.

+ 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