Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There is a compile error on the split line where I need to loop through the
product numbers in each B cell. I got this macro from someone on this list and I do not understand the for/if statement? What I am trying to do is check all product numbers ( commas as delimiters). I need to be absolutely sure there are no duplicate product numbers in any of the other cells. The macro must check ea product number against all other product numbers in all of the other cells rows one by one. That is why there are two loops. Private Sub deleteDups() Dim rng As Range, cell As Range Dim i As Long, c1 As Long Dim rowCount As Long rowCount = R1C2.Count.End(xlUp) Set rng = Range("B1:RowCount") For Each cell In rng v = Split(cell.Text, ",") For i = LBound(v) To UBound(v) c1 = Application.CountIf(rng, "*" & v(i) & "*") If c1 1 Then ' it should be 1 to match itself MsgBox v(i) & " possible dups" cell.Interior.ColorIndex = 3 End If Next Next End Sub Thanks for helping me with the split |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro for dupes | Excel Discussion (Misc queries) | |||
Outer Joins | Excel Discussion (Misc queries) | |||
Checking for Dupes | Excel Discussion (Misc queries) | |||
Marking Dupes | Excel Programming | |||
Advancing outer Loop Based on criteria of inner loop | Excel Programming |