(Solved) – Why does excel keeps crashing after I run the following?

Private Sub Worksheet_Change(ByVal Target As Range)

Dim lrow1 As Long
Dim lrow2 As Long
Dim cell As Range
Dim sell As Range

lrow1 = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
lrow2 = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row

For Each cell In Sheets("Sheet2").Range("A1:A" & lrow2)
For Each sell In Sheets("Sheet1").Range("A1:A" & lrow1)
If cell.Value = sell.Value Then
cell.Offset(0, 1).Value = sell.Offset(0, 1).Value
End If
Next sell
Next cell

End Sub

After I test run the first entry works fine, brings the info correctly, with the second entry excel crashes. Please help

Leave a Reply

Your email address will not be published. Required fields are marked *