View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Halim Halim is offline
external usenet poster
 
Posts: 182
Default How to detech same data in one sheet

Hi,

if you want in vba like this :
Sub findx()
Dim Wk As Worksheet, Mydata, firstfind As String
Mydata = "Your data"
For Each Wk In Worksheets
Set find1 = Wk.Cells.Find(Mydata, LookIn:=xlValues)
If Not find1 Is Nothing Then
MsgBox find1.Parent.Name
Set findnext2 = find1
Do
Set findnext1 = Wk.Cells.FindNext(after:=findnext2)
If Not findnext1 Is Nothing Then
If find1.Address < findnext1.Address Then MsgBox
findnext1.Parent.Name
End If
Set findnext2 = findnext1
Loop Until findnext1.Address = find1.Address
End If
Next Wk
End Sub

--

Regards,

Halim


"ShamsulZ" wrote:

how to know that I'm not key-in the data twice or more in one worksheet? In
my daily job, there is thousands of data and the data cannot duplicate.
Thanks a lot friend.