Results 1 to 3 of 3

Match Cell Content and Delete Cell Content If a Match is Found

Threaded View

  1. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Match Cell Content and Delete Cell Content If a Match is Found

    Hello aviatecar,

    This macro will do what you want. It is included in the attached workbook.
    Sub CleanDescription()
    
        Dim c       As Long
        Dim Data    As Variant
        Dim r       As Long
        Dim Rng     As Range
        Dim RngEnd  As Range
        Dim Wks     As Worksheet
        
            Set Wks = Sheet1
            
            Set Rng = Wks.Range("A3")
            Set RngEnd = Wks.Cells(Rows.Count, "A").End(xlUp)
            Set Rng = IIf(RngEnd.Row > Rng.Row, Wks.Range(Rng, RngEnd), Rng)
            
            Data = Rng.Offset(0, 2).Resize(ColumnSize:=6).Value
            
                For r = 1 To UBound(Data)
                    For c = 2 To 6
                        Data(r, 1) = Replace(Expression:=Data(r, 1), Find:=Data(r, c), Replace:="", Compare:=vbTextCompare)
                    Next c
                Next r
            
            Rng.Offset(0, 2).Resize(ColumnSize:=6).Value = Data
            
    End Sub
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. IF same CONTENT FOUND IN CELL A THEN DELETE CONTENT IN B,C or D
    By mecutemecute in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-11-2013, 01:16 AM
  2. How to examine the content of a range and to delete a cell below a value found
    By sundial in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-21-2013, 04:03 PM
  3. Replies: 2
    Last Post: 07-31-2012, 03:42 PM
  4. [SOLVED] Highlight a cell if its content doesn't match another cells content
    By noxygen in forum Excel General
    Replies: 4
    Last Post: 04-12-2012, 04:36 AM
  5. match entire cell content and delete row
    By hluk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-30-2009, 04:09 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