Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Cross check data  and highlight

Posted on 2011-09-13
4
Medium Priority
?
331 Views
Last Modified: 2012-08-14
Hi Experts,

I would like to request Experts help create a macro to cross check data in column B (Source_ sheet) with data in column B (Data_sheet). The data from Source sheet (Column B)  are generally listed at the end of the list in column B in the Data Sheet.

If the data on the source sheet (Column B) not available at Data sheet, the cell need to highlight with "Red" color. Please ignore data starts with "uration" and "------" during crosschecking process. Hope Experts could help me create this feature.

 
Track-Data.xls
0
Comment
Question by:Cartillo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
heideld earned 2000 total points
ID: 36530050
During a project w while back I modified a bunch code snippets I found on the web to fit my needs, the original sources are unknown...  You can probably do something with this and make it work for you...  (FYI, I was under the gun and never went back to clean it up and make it pretty)




Sub SelectRangeBetween()
    Dim CompareRange As Variant, x As Variant, y As Variant, z As Variant, PDIAddress As Variant, FindingRange As Variant

 
    Set CompareRange = Workbooks("FILENAMEHERE.xlsm"). _
    Worksheets("Sheet2").Range("A2:A675")
    Worksheets("Sheet1").Activate
    Worksheets("Sheet1").Range("A1").Activate
   
Set SelectionRange = Range("D8568:D21861")
    For Each x In SelectionRange

        For Each y In CompareRange

LookY = y.Value


'Set FoundAddress = Cells.Find(LookY, LookIn:=xlValues, After:=ActiveCell)
Set FoundAddress = Cells.Find(LookY, After:=Range("d8568"), LookIn:=xlValues)

 If Not FoundAddress Is Nothing Then

 Worksheets("Sheet1").Activate
            Worksheets("Sheet1").Range(FoundAddress.Address).Activate
 
           
            'This is for when Target is in different Column.
           If FoundAddress.Value = Null Then
            FoundAddress.Offset(0, -2) = y
            FoundAddress.Offset(0, -1) = y.Offset(0, 1)
           ' x.Offset(-1, -2) = x
          '  x.Offset(-1, -1) = y.Offset(0, 1)
            End If
           
            Worksheets("Sheet1").Activate
           
        Worksheets("Sheet1").Range(FoundAddress.Address).Activate
            Set PDIAddress = Cells.Find("PDI:", LookIn:=xlValues, After:=ActiveCell)
           

                If Not PDIAddress Is Nothing Then
                    PDIAddress = PDIAddress.Address
           xAdd = FoundAddress.Offset(0, -3).Address
                    Set FindingRange = Range(xAdd, PDIAddress)
                    FindingRange.Resize(FindingRange.Rows.Count - 1, FindingRange.Columns.Count + 2).Interior.ColorIndex = 3
       
                        With FindingRange.Resize(FindingRange.Rows.Count - 1)
                        .Offset(0, 1) = y
                        .Offset(0, 2) = y.Offset(0, 1)
                                             
                       
                        End With
                       
                Else
                MsgBox ("Value Not Found")
                End If
             End If
        Next y
    Next x
End Sub


0
 
LVL 8

Expert Comment

by:ragnarok89
ID: 36530265
Assuming that the data appears in the same order on the destination sheet, why not just use conditional formatting? If cell is blank, highlight in red.
0
 

Author Comment

by:Cartillo
ID: 36530448
Hi ragnarok89,

I do agree with you but the problem is I'm going to use the sample sheet for crosschecking other data as well by clearing the whole data before resume with a new set of data. That the reason I'm looking for VBA solution instead of conditional formatting. Also intent to combine with other module. Hope you will consider my request.
0
 

Author Closing Comment

by:Cartillo
ID: 37164561
Hi,

Thanks for the help.
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question