+ Reply to Thread
Results 1 to 9 of 9

Identify Characters in a Cell then Delete the row

  1. #1
    Registered User
    Join Date
    07-22-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    5

    Identify Characters in a Cell then Delete the row

    Hi,

    Can anyone out there please help me?

    I am not sure if the following can be automated through a Macro or not, but it would certainly save me loads of time if if could!

    A B C D
    1705 B001705-TU900-1 B001705-TU900-F1-1 49
    1705 B001705-TU900-2 B001705-TU900-F2-2 207
    1705 B001705-TU900-3 B001705-TU900-F3-3 244
    1705 B001705-TUMTS-1 B001705-TUMTS-F1-1 366
    1705 B001705-TUMTS-2 B001705-TUMTS-F2-2 23
    1705 B001705-TUMTS-3 B001705-TUMTS-F2-3 182

    What i need to do is identify "F2" within Column C (Characters 15 & 16) and then delete the row, so i end up with the following:

    A B C D
    1705 B001705-TU900-1 B001705-TU900-F1-1 49
    1705 B001705-TU900-3 B001705-TU900-F3-3 244
    1705 B001705-TUMTS-1 B001705-TUMTS-F1-1 366

    Please help if this is possible so i can get hours of my life back again!

    Thanks
    Dave

  2. #2
    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: Identify Characters in a Cell then Delete the row

    You'd like to delete the whole row if F2 is found, will F2 always be preceded and followed by hyphens?

    And is it populated in column D?
    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."

  3. #3
    Registered User
    Join Date
    07-22-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Identify Characters in a Cell then Delete the row

    Yes and Yes.....

    Thank you...

  4. #4
    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: Identify Characters in a Cell then Delete the row

    Try:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-22-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Identify Characters in a Cell then Delete the row

    Thanks Solus, ill give that a go and let you know how i get on

  6. #6
    Registered User
    Join Date
    07-22-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Identify Characters in a Cell then Delete the row

    Hi Salus

    Unfortunaly i get the below error?

    ---------------------------
    Microsoft Visual Basic
    ---------------------------
    Compile error:

    For without Next
    ---------------------------
    OK Help
    ---------------------------

  7. #7
    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: Identify Characters in a Cell then Delete the row

    Haha my mistake. As you can tell it was untested. Try:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-22-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Identify Characters in a Cell then Delete the row

    Solus, your a star, thank you it works a treat

  9. #9
    Registered User
    Join Date
    07-22-2013
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Identify Characters in a Cell then Delete the row

    Hi Solus,

    As usual my requirements have changed!!! I now i only want to delete Cell B, C and D rather than the entire row.

    I tried the below but it doesnt seem to work? Can you help?

    Sub DeleteDuplicates()

    Dim l As Long
    Dim lRow As Long

    lRow = Range("C56635").End(xlUp).Row

    For l = lRow To 1 Step -1

    If Range("C" & l).Value Like "*-F2-*" Then
    Range("C" & l).Range("B:D").Select
    Selection.Delete Shift:=xlUp
    End If

    Next l

    End Sub

  10. #10
    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: Identify Characters in a Cell then Delete the row

    Try:

    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] Identify (iserror) in cell B1, Copy value E1 into A2, and delete row 1.
    By Groovo in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-31-2013, 07:58 PM
  2. [SOLVED] Identify Cells with value of 0 and delete 0 cell and adjacent cell
    By brgr4u in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-16-2013, 09:04 AM
  3. Delete last 9 characters from a cell
    By Tom K in forum Excel General
    Replies: 1
    Last Post: 03-05-2008, 02:10 PM
  4. delete certain characters from a cell
    By legolas in forum Excel General
    Replies: 4
    Last Post: 09-19-2007, 04:20 AM
  5. Replies: 3
    Last Post: 08-20-2006, 05:45 PM

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