Results 1 to 10 of 10

How to stop an endless loop

Threaded View

  1. #1
    Registered User
    Join Date
    06-20-2014
    Location
    Croatia
    MS-Off Ver
    2010
    Posts
    17

    How to stop an endless loop

    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
    Last edited by petar256; 01-10-2018 at 01:42 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] endless loop
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-25-2015, 02:17 PM
  2. Endless loop
    By kathhying in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2011, 01:17 PM
  3. Endless Loop?
    By teaker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-16-2009, 10:39 AM
  4. Endless loop
    By freddie mac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2006, 10:25 AM
  5. endless loop help
    By John in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2005, 12:05 PM
  6. Endless loop?
    By John in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 08-02-2005, 02:05 PM
  7. Interrupting an endless loop
    By davegb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2005, 02:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1