+ Reply to Thread
Results 1 to 3 of 3

Looping Macro Issue - Infinate Loops

  1. #1
    Registered User
    Join Date
    10-02-2012
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    9

    Looping Macro Issue - Infinate Loops

    Hey all,

    I have a macro that i've writen, what it does is looks for a specific text within Column C (in this case INCOMPLETE) then copies the 2 cells to the left of the word over to the right one column before continuing the lap number in column A.

    So Column A is Laps counting up, Column B is a Time and Column C is a Speed - Below is a example of the data pre-macro running


    Lap Time Speed
    1 18.7 67
    2 34.5 55
    3 25.0 60
    23.3 62 Incomplete

    Data Post Macro run

    Lap Time Speed
    1 18.7 67
    2 34.5 55
    3 25.0 60
    4 23.3 62

    This in itself is perfect, the data aligns correctly and gives me the correct outcome but i seem to have got the macro stuck into a infinite loop, it currently loops to look for more then one instance of the word "incomplete" being in the data but it continues and cannot get it to stop.

    You will see i have tried to force a exit route by allowing it to exit to a non value (hhh) if it finds an error but i'm not sure what to do to stop it flagging the error Run-time erro 91 - Object variable or With block variable not set and highlights the code - Loop While rFind.Address <> sAddress

    The code is hopefully attached (i'm not sure how to show it nicely in the post like others have done)

    Can someone help stop it looping as i've got this far and seem so close!
    Attached Files Attached Files

  2. #2
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Looping Macro Issue - Infinate Loops

    Try this:

    Please Login or Register  to view this content.
    Gary's Student

  3. #3
    Registered User
    Join Date
    10-02-2012
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Looping Macro Issue - Infinate Loops

    Perfect, many thanks!!

+ 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