Solved

Cross check data  and highlight

Posted on 2011-09-13
4
325 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 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

749 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