LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default del dupes in a split cell, outer loop

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro for dupes shaji Excel Discussion (Misc queries) 2 June 17th 08 04:51 PM
Outer Joins The Rook[_2_] Excel Discussion (Misc queries) 3 March 15th 07 04:20 PM
Checking for Dupes TKnTexas Excel Discussion (Misc queries) 4 November 3rd 06 02:43 AM
Marking Dupes GregR Excel Programming 7 January 10th 06 02:17 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM


All times are GMT +1. The time now is 07:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"