Emoncada
11-13-2015, 08:30 AM
I have a column that i would like to see if there is a duplicate on another sheet, before it runs a macro.
So i would need it to test any values <> "" , in column "A:A" on Sheet1, and find if there is a match on Sheet2 Column "A:A"
If one matches then
If found
MsgBox("There is a Match")
else
next
I have the following code that works in a Userform but it only the value of a TextBox in the Userform, i need it to look at all values in a column now
Set Found = wd.Range("A5:A60000").Find(UserForm1.TxtSerial.Value, LookIn:=xlValues)
If Found Is Nothing Then
.Cells(RowNext1, 1) = UserForm2.TxtDate.Value
.Cells(RowNext1, 2) = UserForm2.TxtSerial.Value
.Cells(RowNext1, 3) = Environ("Username")
Else
FDate = Found.Offset(0, -2).Value
If MsgBox("Serial Number Found on " & FDate & Chr(10) & _
"Do You Still Want To Process?", vbYesNo) = vbYes Then
.Cells(RowNext1, 1) = UserForm2.TxtDate.Value
.Cells(RowNext1, 2) = UserForm2.TxtSerial.Value
.Cells(RowNext1, 3) = Environ("Username")
End If
So i would need it to test any values <> "" , in column "A:A" on Sheet1, and find if there is a match on Sheet2 Column "A:A"
If one matches then
If found
MsgBox("There is a Match")
else
next
I have the following code that works in a Userform but it only the value of a TextBox in the Userform, i need it to look at all values in a column now
Set Found = wd.Range("A5:A60000").Find(UserForm1.TxtSerial.Value, LookIn:=xlValues)
If Found Is Nothing Then
.Cells(RowNext1, 1) = UserForm2.TxtDate.Value
.Cells(RowNext1, 2) = UserForm2.TxtSerial.Value
.Cells(RowNext1, 3) = Environ("Username")
Else
FDate = Found.Offset(0, -2).Value
If MsgBox("Serial Number Found on " & FDate & Chr(10) & _
"Do You Still Want To Process?", vbYesNo) = vbYes Then
.Cells(RowNext1, 1) = UserForm2.TxtDate.Value
.Cells(RowNext1, 2) = UserForm2.TxtSerial.Value
.Cells(RowNext1, 3) = Environ("Username")
End If