+ Reply to Thread
Results 1 to 13 of 13

Delete Row with string containing special character

  1. #1
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Delete Row with string containing special character

    I am trying to delete rows that contain text with a special character in column O. The text I am searching for contains PO# and will look something like this PO#B7605887-1, so I need it to be PO#* so it catches the text if it contains anything after the special character.

    The code I created below is not working. What am I doing wrong?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Delete Row with string containing special character

    try this change
    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Delete Row with string containing special character

    Do any values contain the letters "PO" without containing the symbol #?

    maybe
    Please Login or Register  to view this content.
    Last edited by Solus Rankin; 02-24-2014 at 02:31 PM.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Delete Row with string containing special character

    Another:

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 02-24-2014 at 03:42 PM.

  5. #5
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Delete Row with string containing special character

    Solus, if I add the * after "PO", then it would delete also delete rows with words that start with a PO, like possible or potential, etc. I need it to delete rows with the phrase "PO#".

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Delete Row with string containing special character

    Hi, John,

    your code
    Please Login or Register  to view this content.
    isnīt qualfied for Sheets("Call Data") but should refer to the ActiveSheet instead.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Delete Row with string containing special character

    Quote Originally Posted by HaHoBe View Post
    Hi, John,

    your code
    Please Login or Register  to view this content.
    isnīt qualfied for Sheets("Call Data") but should refer to the ActiveSheet instead.

    Ciao,
    Holger

    "Call Data" is the activesheet? Isn't it?

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Delete Row with string containing special character

    Hi, John,

    I donīt know to be honest. But if I see a code like
    Please Login or Register  to view this content.
    Iīd go the way to use
    Please Login or Register  to view this content.
    to avoid any possible other activesheet or
    Please Login or Register  to view this content.
    Ciao,
    Holger

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Delete Row with string containing special character

    @ HaHoBe - I agree with you completely. But what I gathered from the sub in Post#1 was two possibly unnecessary With Statements. No mention of other workbook objects or range objects or sheet objects. Perhaps I'm wrong as well.

  10. #10
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Delete Row with string containing special character

    I use the same code to delete rows with other text strings, the problem I'm having is that it is not deleting any rows that contain "#". I'm looking for code that helps me handle that issue.

  11. #11
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Delete Row with string containing special character

    Did you test all the suggestions?

  12. #12
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Delete Row with string containing special character

    Sorry. This should fix that problem:
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    01-30-2011
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    604

    Re: Delete Row with string containing special character

    Try this...

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. Replies: 2
    Last Post: 12-02-2013, 03:29 PM
  2. [SOLVED] Finding special character in a string
    By sathishkm in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-01-2013, 06:10 AM
  3. [SOLVED] extract string after nth string (special character)
    By itselflearn in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-24-2013, 03:18 PM
  4. [SOLVED] Delete row that contains special character *
    By canada123 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-17-2013, 12:25 PM
  5. remove special character at end of string
    By captain bob in forum Excel General
    Replies: 0
    Last Post: 08-03-2006, 09:59 AM

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