Hi experts,
i m using this code but its not working when found error or no value. please help on this
i want if any cell found value then skip for next cell
Sub match()
Dim rng As Range, FinalResult As Variant, Table_Range As Range
Dim L1 As Range
Dim ws As Worksheet
Dim ws1 As Worksheet
Dim cn_m As Range
Dim lastrow As Long
Dim i As Long
Set ws = Sheets("Data")
Set ws1 = Sheets("Sheet2")
Set cn_m = ws.Range("A:A")
lastrow = ws1.Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To lastrow
Set L1 = ws1.Range("A" & i)
On Error GoTo NM
If Application.WorksheetFunction.match(L1, cn_m, 0) > 0 Then
Exit For
Else
NM:
MsgBox "New Record"
End If
Next i
End Sub
i m using this code but its not working when found error or no value. please help on this
i want if any cell found value then skip for next cell
Sub match()
Dim rng As Range, FinalResult As Variant, Table_Range As Range
Dim L1 As Range
Dim ws As Worksheet
Dim ws1 As Worksheet
Dim cn_m As Range
Dim lastrow As Long
Dim i As Long
Set ws = Sheets("Data")
Set ws1 = Sheets("Sheet2")
Set cn_m = ws.Range("A:A")
lastrow = ws1.Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To lastrow
Set L1 = ws1.Range("A" & i)
On Error GoTo NM
If Application.WorksheetFunction.match(L1, cn_m, 0) > 0 Then
Exit For
Else
NM:
MsgBox "New Record"
End If
Next i
End Sub