View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Find dupes, list in MsgBox with cell.address convert ws wide code to one sheet

Hi Howard,

Am Sun, 25 May 2014 08:40:59 -0700 (PDT) schrieb L. Howard:

Trying to convert this code to sheet 1 only, one column only (col T) and list all dupes in a msgbox with cell.address.

The search item could be for a number or text.


the first match will be ignored. All other matches will be listed:

Sub FindDupes()
Dim LRow As Long, i As Long
Dim myStr As String

With Sheets("Sheet1")
LRow = Cells(Rows.Count, "T").End(xlUp).Row
For i = 1 To LRow
If WorksheetFunction.CountIf(.Range(.Cells(1, "T"), _
.Cells(i, "T")), .Cells(i, "T")) 1 Then
myStr = myStr & .Cells(i, "T").Value & vbTab & _
.Cells(i, "T").Address(0, 0) & Chr(10)
End If
Next
End With
MsgBox myStr
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional