Hi
Please evalute my code and teach me how can i stop my endless loop which chrashes my excel. The code works on smaller range like on 100 rows. But i need it to be 5000 since there is a lot of data.
Esentially I have two columns. I want to search the number from column F if it exists in column B ( sheet2). If it exists i want write the text next to it.
Sub kontaglavnice()
Dim rng1 As Range
Dim rng2 As Range
Dim x As Variant
Dim y As Variant
Set rng1 = Worksheets(1).Range("F9:F5000")
Set rng2 = Worksheets(2).Range("B2:B5000")
For Each x In rng1
For Each y In rng2
If x = y Then
x.Offset(0, 1).Value = "Glavnica"
End If
Next y
Next x
End Sub
Loops endlessly and chrashes excell
Bookmarks