i have a 70 names with phone numbers, how can i check with For or if else statement or both if there is phone number which is duplicating and remove the number. Thanks in advance!
Sub GenerateNames()
Dim ssheet1 As Worksheet
Dim rngen As Worksheet
Dim rnsheet As Worksheet
Dim i As Integer, intValueToFind As Integer
intValueToFind = 12345
Set ssheet1 = ThisWorkbook.Sheets("Sheet1")
Set rngen = ThisWorkbook.Sheets("RnGen")
Set rnsheet = ThisWorkbook.Sheets("RandomNames")
rngen.Range("A3:A70").Copy rnsheet.Range("A3:A70")
ssheet1.Range("B3:B70").Copy rnsheet.Range("B3:B70")
For b = 1 To 70
If Cells(b, 2).Value = intValueToFind Then
MsgBox ("Found value on row " & i)
Exit Sub
End If
Next b
MsgBox ("Value not found in the range!")
End Sub
Aucun commentaire:
Enregistrer un commentaire