我做一个对A列数据查找重复的程序,希望有重复时停在重复的行这个位置以便修改,请问这个停留语句如何写?
Private Sub CommandButton1_Click()
Dim DataX As Long, DataX1 As Long
Dim Item1 As String, Response As String, Item2 As String, Item As String
For DataX = 4 To 5004
Item = CStr(Cells(DataX, 1))
For DataX1 = 5 To 5004
Item1 = CStr(Cells(DataX1, 1))
If Item = Item1 Then
Response = MsgBox("数据重复", vbOKOnly)
DataX1
Exit Sub
End If
Next
Next
End Sub
Private Sub CommandButton1_Click()
Dim DataX As Long, DataX1 As Long
Dim Item1 As String, Response As String, Item2 As String, Item As String
For DataX = 4 To 5004
Item = CStr(Cells(DataX, 1))
For DataX1 = 5 To 5004
Item1 = CStr(Cells(DataX1, 1))
If Item = Item1 Then
Response = MsgBox("数据重复", vbOKOnly)
DataX1
ACTIVESHEET.cells(DtaX1,1).activate
Exit Sub
End If
Next
Next
End Sub