+ Reply to Thread
Results 1 to 12 of 12

how to avoid infinite loops ine excel vba ?

  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 .

    Please Login or Register  to view this content.
    Last edited by meen2525; 10-26-2011 at 07:46 AM. Reason: add code tags for newbie

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: how to avoid infinite loops ine excel vba ?

    Have you got a sample workbook?

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: how to avoid infinite loops ine excel vba ?

    Something like this
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    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 ?

    Hii RoyUk,
    Still a problem but Thanks a lot for replying . The infinite loop has stopped now :D yippee..
    but the problem now is its higlighting the cells which STARTS with PT50. I want it other way round. Highlight the cells NOT STARTIN with PT50. wat to dooo ? plllleaaase help.Thaaaaaanks in advance.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: how to avoid infinite loops ine excel vba ?

    If you study the code then you will learn. It;s not difficult to change
    Please Login or Register  to view this content.

  6. #6
    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:

    Please Login or Register  to view this content.
    Last edited by meen2525; 10-26-2011 at 07:41 AM.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: how to avoid infinite loops ine excel vba ?

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

  8. #8
    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 ?

    Hi,
    really sorry I did not find that option before. Have modified it now so is there any way we can JUST color those cells NOT STARTING with PT50 ?

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: how to avoid infinite loops ine excel vba ?

    You've used Quote Tags not Code Tags

    Please edit them & check this

    Please Login or Register  to view this content.
    Last edited by royUK; 10-25-2011 at 03:56 AM.

  10. #10
    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 ?

    thanks a loooot RoyUk helped me a lot.this thread is solved but i dunno how to mark it .help this newbie out .

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: how to avoid infinite loops ine excel vba ?

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  12. #12
    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 ?

    thank you did the same

+ Reply to Thread

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