need to compare two lists and identify cells with same numbers in
Assuming that the data is on Sheet1 and Sheet2 in column A, this creates
conditional formatting for it
Sub Duplicates()
Dim iLastRow As Long
ActiveWorkbook.Names.Add Name:="Sheet2A", RefersToR1C1:="=Sheet2!C1"
With Worksheets("Sheet1")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
With .Range("A1:A" & iLastRow)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression,
Formula1:="=COUNTIF(Sheet2A,A1)0"
.FormatConditions(1).Interior.ColorIndex = 3
End With
End With
ActiveWorkbook.Names.Add Name:="Sheet1A", RefersToR1C1:="=Sheet1!C1"
With Worksheets("Sheet2")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
With .Range("A1:A" & iLastRow)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression,
Formula1:="=COUNTIF(Sheet1A,A1)0"
.FormatConditions(1).Interior.ColorIndex = 3
End With
End With
End Sub
--
HTH
Bob Phillips
(remove xxx from email address if mailing direct)
"Bockhamptoner" wrote in message
...
I receive a list of numberic incident numbers every day and need to write
a
macro to compare yesterdays list to todays list to identify which are new
numbers. Would also like to run it the other way round on yesterdays list
to
identify which numbers are missing from todays list so that I can easily
check that calls have been closed properly.
|