+ Reply to Thread
Results 1 to 10 of 10

Find certain text and delete row then show MsgBox

  1. #1
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Find certain text and delete row then show MsgBox

    Hi all,

    I've almost got this but not quite so I've resorted to posting in this excellent forum.

    I'm trying to have a macro search columns A:B (to last row with data) and then delete any rows which contain the sequence of letters "test1" OR "test2".

    I say sequence of letters because there could be other string in the cell and the word "test1" may have characters before or after it, i.e. "ttest1" "test12". In both these examples the rows would be deleted. Also I don't want it to be case sensitive so "teST1",TEst1" would be deleted too.

    Then a MsgBox to say how many instances of Test1 and Test2 were deleted.

    Thanks

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Find certain text and delete row then show MsgBox

    Hi Plumby,
    maybe something like this
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Re: Find certain text and delete row then show MsgBox

    Hi Nilem,

    Sorry, that did not work. I received the 'Cannot use that command on overlapping sections' error for the last line of code

    Please Login or Register  to view this content.

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Find certain text and delete row then show MsgBox

    Can you attach an example of your file

  5. #5
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Re: Find certain text and delete row then show MsgBox

    Sure. Here you go I have attached dummy data. In this example all the rows would be deleted.
    Attached Files Attached Files

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Find certain text and delete row then show MsgBox

    try again
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Re: Find certain text and delete row then show MsgBox

    Brilliant!! Thank you!

    How would I add a MsgBox to this at the end to state how many instances of Test1 and Test2 were found?

  8. #8
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Re: Find certain text and delete row then show MsgBox

    Hi Nilem,

    I've sorted the MsgBox out. Thank you for your help I shall mark this as SOLVED. Can I ask what this line of code does please:

    Please Login or Register  to view this content.

  9. #9
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Find certain text and delete row then show MsgBox

    Please Login or Register  to view this content.
    SpecialCells(2, 4) means SpecialCells(xlCellTypeConstants, xlLogical)

  10. #10
    Forum Contributor
    Join Date
    08-23-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    404

    Re: Find certain text and delete row then show MsgBox

    Just seen your code. This is my MsgBox code:

    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)

Similar Threads

  1. [SOLVED] how to add counter in msgbox to show remain times the message will show vba code
    By sspreyer in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-25-2013, 06:46 AM
  2. [SOLVED] Can't show cell comment text in Msgbox
    By zbor in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-02-2012, 05:51 AM
  3. Replies: 4
    Last Post: 09-18-2012, 10:54 AM

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