+ Reply to Thread
Results 1 to 12 of 12

mark color for not matched items for adjacent cells based on another adjacent cells

  1. #1
    Forum Contributor
    Join Date
    06-17-2021
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    219

    mark color for not matched items for adjacent cells based on another adjacent cells

    hello

    I search for macro to highlighted font for some unmatched items into column A and compare with column B for each sheet .

    so should match adjacent cells into column A with adjacent cells into column B . if there are unmatched items then should highlighted by red .
    the result should be into column A for sheets 1,2,3 . I put desired result in result sheet1,2,3
    thanks
    Attached Files Attached Files
    Last edited by tubrak; 03-13-2022 at 06:20 AM.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hello, try this !


    According to your attachment a VBA demonstration for starters (v3) :

    PHP Code: 
    Sub Demo1()
           Const 
    " "
             
    Dim Ws As WorksheetVR&, S&, WL&
        For 
    Each Ws In Worksheets
             V 
    Ws.[A1].CurrentRegion.Value2
            With Ws
    .Range("A2:A" UBound(V)).Font:  .Bold False:  .ColorIndex xlAutomatic:  End With
         
    For 2 To UBound(V)
             
    1
             V
    (R2) = V(R2) & D
         
    For Each W In Split(V(R1))
             
    Len(W)
             If 
    InStr(V(R2), D) = 0 Then With Ws.Cells(R1).Characters(SL).Font: .Bold True: .Color vbRedEnd With
             S 
    1
        Next W
    RWs
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 03-14-2022 at 06:29 AM. Reason: optimization …

  3. #3
    Forum Contributor
    Join Date
    06-17-2021
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    219

    Re: mark color for not matched items for adjacent cells based on another adjacent cells

    thanks for your code.
    actually I don't find the wrong result in sheet1. forgive me can you show me?
    by the way there is problem in cells A6 into sheet1 contains MN and not existed in column B , then should highlighted,but the code doesn't do that.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: mark color for not matched items for adjacent cells based on another adjacent cells


    Quote Originally Posted by tubrak View Post
    by the way there is problem in cells A6 into sheet1 contains MN and not existed in column B
    Wrong ‼ And by the way this is your error in 'result sheet1' …

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: mark color for not matched items for adjacent cells based on another adjacent cells


    Or do you just compare a cell with only another cell in the same row and not with all the column (as you wrote cells) ?

  6. #6
    Forum Contributor
    Join Date
    06-17-2021
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    219

    Re: mark color for not matched items for adjacent cells based on another adjacent cells

    my topic is adjacent cells , also explanation . this means a2=b2,a3=b3 and so on the rest of cells .
    as you wrote cells) ?
    I don't think to be this word CELLS will make completely confusing for you . sorry !
    do you just compare a cell with only another cell in the same row
    yes . I had to use this sentence to understand my idea .

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: mark color for not matched items for adjacent cells based on another adjacent cells


    According to this clear explanation try the updated demonstration in post #2 …

  8. #8
    Forum Contributor
    Join Date
    06-17-2021
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    219

    Re: mark color for not matched items for adjacent cells based on another adjacent cells

    thanks again.
    I note this item K/L in column A ,if add L in column A ,then it doesn't highlight it . the code considers it is existed . K/L should be whole item is different ,for L .
    last thing. I try understanding your code and mod your code when change item in column B and match with item has already highlighted into column A to delete the color instead of do that manually ,but I don't succeed so for.
    I mod a simple in your code .
    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: mark color for not matched items for adjacent cells based on another adjacent cells


    Did not you think about the easy mod just adding a leading space like in the updated post #2 …

  10. #10
    Forum Contributor
    Join Date
    06-17-2021
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    219

    Re: mark color for not matched items for adjacent cells based on another adjacent cells

    why when you put the space into variable then the code works without any problem ?

  11. #11
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: mark color for not matched items for adjacent cells based on another adjacent cells


    Just according to the Logic to compare words space delimited …

  12. #12
    Forum Contributor
    Join Date
    06-17-2021
    Location
    Asia
    MS-Off Ver
    2019
    Posts
    219

    Re: mark color for not matched items for adjacent cells based on another adjacent cells

    thanks for your help

+ 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. Copy values from adjacent cells to groups of adjacent cells with gaps
    By Kneigum in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-08-2017, 04:50 PM
  2. Replies: 3
    Last Post: 06-15-2017, 05:42 PM
  3. How to match cells and copy adjacent cells once matched.
    By eekbubble in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-16-2015, 11:29 AM
  4. Automatically delete cells based on adjacent cell color
    By chromecarz00 in forum Excel General
    Replies: 1
    Last Post: 04-17-2014, 07:05 PM
  5. [SOLVED] Copy adjacent cells based on matched cell criteria
    By asdfwqefwe3 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-26-2013, 02:26 AM
  6. [SOLVED] Coloring Cells based on adjacent cell color
    By smugglersblues in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-04-2013, 09:36 PM
  7. Replies: 3
    Last Post: 07-30-2012, 11:20 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