Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Searching For Duplicates

Ihave a spreadsheet of over 2000 lines. It consists of Pat code,
description, color, UPC. I would like to search the data base for duplicat
Part codes and duplicat UPC's. Is there an eay way.

Thanks in advance,''Doug
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Searching For Duplicates

Sub Dubletter() ' i område
Dim x, r As Double, c As Double, t, t2
Dim v(1000)
'x = Range("A1:J15")
x = Application.InputBox(prompt:="Select range, or write in box fx.
A1:B2000: ", Type:=8)
For c = 1 To UBound(x, 2)
For r = 1 To UBound(x, 1)
If x(r, c) < "" Then t = t + 1: v(t) = x(r, c)
Next
Next

For t = 1 To UBound(v)
If v(t) < "" Then
For t2 = t + 1 To UBound(v)
If v(t) = v(t2) Then
v(t2) = Empty
End If
Next
End If
Next
Application.InputBox(prompt:="Where do u want the List ? (click on cell): ",
Type:=8).Select
For t = 1 To UBound(v)
Cells(t, ActiveCell.Column) = v(t)
Next
On Error Resume Next
Selection.Columns.SpecialCells(xlCellTypeBlanks).R ows.Delete Shift:=xlUp
Range(ActiveCell, ActiveCell.End(xlDown)).Select
If MsgBox("Do u want to sort the list ?", vbYesNo, "No dublets") = vbYes Then
Selection.Sort Key1:=Range(ActiveCell.Address), Order1:=xlAscending
End If
ActiveCell.Select
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Searching For Duplicates

In this example the data is in the range A1:D5.

Sub ShowDups()

Dim i As Long
Dim LR As Long
Dim arrRange
Dim collPatCode As Collection
Dim collUPC As Collection

Set collPatCode = New Collection
Set collUPC = New Collection

arrRange = Range(Cells(2, 1), Cells(5, 4))
LR = UBound(arrRange)

On Error Resume Next

For i = 1 To LR
collPatCode.Add arrRange(i, 1), CStr(arrRange(i, 1))
If Err.Number < 0 Then
Cells(i + 1, 1).Interior.ColorIndex = 6
Err.Clear
End If
Next

For i = 1 To LR
collUPC.Add arrRange(i, 4), CStr(arrRange(i, 4))
If Err.Number < 0 Then
Cells(i + 1, 4).Interior.ColorIndex = 7
Err.Clear
End If
Next

End Sub

It will colour the cells, but you can easily adapt it to make it do
something else with the duplicate items.


RBS


"flirodr" wrote in message
...
Ihave a spreadsheet of over 2000 lines. It consists of Pat code,
description, color, UPC. I would like to search the data base for
duplicat
Part codes and duplicat UPC's. Is there an eay way.

Thanks in advance,''Doug


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Searching For Duplicates


flirodr wrote:
*Ihave a spreadsheet of over 2000 lines. It consists of Pat code,
description, color, UPC. I would like to search the data base for
duplicat
Part codes and duplicat UPC's. Is there an eay way.

Thanks in advance,''Doug *




--
davidmy
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message2504508.html



Reply
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
Duplicates in excel that aren't 100% DUPLICATES ... [email protected] Excel Discussion (Misc queries) 4 May 2nd 08 06:43 PM
Searching, matching then searching another list based on the match A.S. Excel Discussion (Misc queries) 1 December 13th 06 05:08 AM
Instructions on searching workbook for duplicates in Excel TJ@HB Excel Discussion (Misc queries) 0 October 30th 06 04:55 PM
searching for and deleting duplicates Shandy720[_11_] Excel Programming 2 July 28th 06 12:12 PM
Searching for Duplicates across columns and print to new column ExcelMonkey Excel Programming 1 July 14th 05 06:09 PM


All times are GMT +1. The time now is 05:42 AM.

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"