Results 1 to 12 of 12

how to avoid infinite loops ine excel vba ?

Threaded View

  1. #5
    Registered User
    Join Date
    10-25-2011
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: how to avoid infinite loops ine excel vba ?

    Hiii,
    I found a way to overcome it.But it colours all other blank cells too . can we JUST color those cells NOT STARTING with PT50 ? any expert advice on this ?? Thaaaaanks in advance

    Please find the code below i modified from yours.

    Code:

    Option Explicit
    
    Sub IbanNo()
        Dim LR As Long
        Dim iX As Long
        Dim rRng As Range
        LR = ActiveSheet.UsedRange.Rows.Count
    
        For iX = 4 To LR
    
            If Left(Cells(iX, 16), 4) <> "PT50" Then
                If rRng Is Nothing Then
                    Set rRng = Cells(iX, 16)
                Else: Set rRng = Union(rRng, Cells(iX, 16))
                End If
            End If
        Next iX
        With rRng
            .Interior.ColorIndex = 3
        End With
    End Sub
    Last edited by meen2525; 10-26-2011 at 07:41 AM.

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