View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jared Jared is offline
external usenet poster
 
Posts: 109
Default show result in msg box

I created a macro which checks for duplicates entries:
I would like the macro to display a message box with the name found and then
requst if wanted to be deleted. I can't seem to be able to put in the name in
the msgbox.

thanks, jared

Sub Check_4_Dups()
Dim first As String
Dim Second As String
Dim i As Integer
Dim Response


For i = 3 To 52
first = Cells(i, 4).Value
If first < "Employee's Name" Then
For n = i + 1 To 52
Second = Cells(n, 4).Value
If Second < "Employee's Name" Then
If first = Second Then Response = MsgBox("The Name "
&First& "Appears Twice, Do you want to delete one entry?", vbYesNo, "Check
for Duplicate names")
If Response = vbYes Then Cells(n, 4) = "Employee's Name"
End If
Next n
End If
Next i
End Sub