Results 1 to 5 of 5

HELP! Compare cells of a column to same column in different workbook and highlight diffs

Threaded View

bradleyherron HELP! Compare cells of a... 02-04-2014, 09:07 AM
alansidman Re: HELP! Compare cells of a... 02-04-2014, 09:16 AM
bradleyherron Re: HELP! Compare cells of a... 02-04-2014, 09:53 AM
alansidman Re: HELP! Compare cells of a... 02-04-2014, 09:55 AM
bradleyherron Re: HELP! Compare cells of a... 02-05-2014, 10:18 AM
  1. #1
    Registered User
    Join Date
    06-25-2013
    Location
    VA
    MS-Off Ver
    Excel 2007
    Posts
    3

    HELP! Compare cells of a column to same column in different workbook and highlight diffs

    Hi,

    I am essentially a complete novice at VBA. I have used it in the past but usually only by recording a macro to do what I want, looking at the macro code and attempting to make it automated.

    I am working with 2 workbooks of production order data. What I have is a file from last week and a 2nd file from this week. Completed orders will drop out of the 2nd file and I'm not concerned with those. New orders will show up in the 2nd file but there is nothing that identifies them as new orders. What I would like to do is compare each order from the 2nd file to the orders in the 1st file and change the font color of (or highlight) the entire row in the 2nd file if the order is NOT in the 1st file. These would be the new orders I want to view. I have been trying to use the .Find command but am not having any luck. Here is some sample data and the code I am tyring to create. Each order number is unique so there will not be duplicates.

    Any help is greatly appreciated.

    Thanks,

    Bradley

    P.S. - Row 1 is blank, Row 2 contains headers and Row 3 begins data
    P.P.S. - I am unable to upload a file with the data and macro code, sorry.

    Sample data:
    Workbook 1				                        Workbook 2		
    Order_Number	Due_Date	P/N		                Order_Number	Due_Date	P/N
    000500907482	04/18/2012	ITM003690488		        0050175100	10/23/2014	SAP000000000540183
    000500907483	04/18/2012	ITM003690488		        0050175101	11/10/2014	SAP000000000540184
    0050194300	11/10/2014	SAP000000000539503		0050284344	10/28/2014	SAP000000001222638
    000500903885	04/30/2012	ITM003694834		        0050194300	11/10/2014	SAP000000000539503
    0050284344	10/28/2014	SAP000000001222638		0050211316	11/10/2014	SAP000000000539479
    0050284345	10/28/2014	SAP000000001222639		0050284345	10/28/2014	SAP000000001222639
    Sub Compare_to_last_FO_Daily_Dispatch_List()
    
        Dim Order_Number As Object
        Dim Order_Number_To_Check As Integer
        Dim wkbA As Workbook
        Dim wkbB As Workbook
        Dim varSheetA As Variant
        Dim varSheetB As Variant
        Dim New_Order As Range
        Dim Check_Order As Range
        
        Set wkbA = Workbooks.Open(Filename:="C:\workbook1.xlsx")
        Set varSheetA = wkbA.Sheets("Page2_1").Range("a3:a1500")
        
        Set wkbB = Workbooks.Open(Filename:="C:\workbook2.xlsx")
        Set varSheetB = wkbB.Sheets("Page2_1").Range("a3:a1500")
        
            
        For Each Order_Number In varSheetA
            Check_Order = varSheetB.Find(what:="Order_Number", after:="varSheetB(f3)", LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows)
                If Not Check_Order Is Nothing Then
                    
                Else
                    Order_Number.Parent.Activate
                    Order_Number.EntireRow.Select
                        With Selection.Font
                            .Color = -16776961
                            .TintAndShade = 0
                        End With
                End If
        Next
            
    End Sub
    Last edited by bradleyherron; 02-04-2014 at 09:09 AM. Reason: correct title to be more accurate

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Compare 2 cells in a worksheet and highlight if different?
    By loulouk in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-17-2012, 01:44 PM
  2. Replies: 5
    Last Post: 09-24-2012, 05:14 PM
  3. [SOLVED] compare and highlight, same row, same column, but two different worksheets
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-31-2012, 10:57 AM
  4. Compare 2 column and highlight
    By tanshida1201 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-04-2011, 11:15 AM
  5. compare two column & highlight
    By johncena in forum Excel General
    Replies: 5
    Last Post: 04-21-2010, 05:48 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