Results 1 to 12 of 12

how to avoid infinite loops ine excel vba ?

Threaded View

meen2525 how to avoid infinite loops... 10-25-2011, 01:39 AM
JapanDave Re: how to avoid infinite... 10-25-2011, 02:06 AM
royUK Re: how to avoid infinite... 10-25-2011, 02:22 AM
meen2525 Re: how to avoid infinite... 10-25-2011, 02:32 AM
meen2525 Re: how to avoid infinite... 10-25-2011, 02:41 AM
royUK Re: how to avoid infinite... 10-25-2011, 02:37 AM
royUK Re: how to avoid infinite... 10-25-2011, 02:51 AM
meen2525 Re: how to avoid infinite... 10-25-2011, 03:02 AM
royUK Re: how to avoid infinite... 10-25-2011, 03:02 AM
meen2525 Re: how to avoid infinite... 10-26-2011, 07:44 AM
royUK Re: how to avoid infinite... 10-26-2011, 07:46 AM
meen2525 Re: how to avoid infinite... 10-26-2011, 07:46 AM
  1. #1
    Registered User
    Join Date
    10-25-2011
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    10

    Post how to avoid infinite loops ine excel vba ?

    Hiii alll,
    I have a requirement where I should check all the USED cells of an entire column and find if the first 4 letters is PT50.If its not PT50 it must be colored.However my code is going in infinte loop its processing all rows in the sheet.(those without data too).doesn stop.
    HELPPPPPPPPPP how to avoid this infinite loop
    this is my code
    .Pleeeeeeeeeeeeeese correct it .seekin yr guidance .

    Sub IbanNo()
    
    Dim Result As String
    LR = ActiveSheet.UsedRange.Rows.Count
    
    
    For i = 4 To LR
    
    
    val1 = Cells(i, 16).Value
    Result = Left(val1, 4)
    
    If Not Result Like "PT50" Then
    Cells(i, 16).Select
        With Selection.Font
            .Color = -16776961
            .TintAndShade = 0
        End With
    
    End If
    
    Next i
    
    End Sub
    Last edited by meen2525; 10-26-2011 at 07:46 AM. Reason: add code tags for newbie

Thread Information

Users Browsing this Thread

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

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