can you see where is the issue with nested loop in VBA Excel:

What I am trying to do is to check data (different range and also some duplicate data may occur)

[![enter image description here](https://i.stack.imgur.com/hvVL3.png)](https://i.stack.imgur.com/hvVL3.png)

Dan - Sheet with pattern data
Tab - Sheet with data that requires additional ID information when Name is same.
To check it I select one cell in Dan and proof it with entire column from pattern Tab sheet

Code:

```
Sub MatchName()
Dim n1 As Long
Dim n2 As Long

 Dim LastRowcheck1 As Long
 Dim LastRowcheck2 As Long

LastRowcheck1 = Sheets("Tab").Range("C" & Rows.Count).End(xlUp).Row
LastRowcheck2 = Sheets("Dan").Range("A" & Rows.Count).End(xlUp).Row

Sheets("Tab").Activate
 For n1 = 2 To LastRowcheck1
   For n2 = 2 To LastRowcheck2
        If Sheets("Tab").Cells(n1, 1) = Sheets("Dan").Cells(n2, 1) Then
        Sheets("Tab").Cells(n1, 6) = Sheets("Dan").Cells(n2, 1)
        Sheets("Tab").Cells(n1, 30) = Sheets("Dan").Cells(n2, 2)
    Next n2
  Else
     Next n1
End Sub

```