An infinite loop discussion

Lukums

Board Regular
Joined
Nov 23, 2015
Messages
195
G'day!

I've designed an automation system which purely runs in vBA to 21 roll formers in our factory (mainly) thanks to each of you for helping along the way!

However -

I've hit which I believe to be a snag.

I run an ENDLESS loop - infinite loop.

Checking if (batch complete) - "1" is found in CELL "C3" if so - I select the row - shift it out into a completed workbook, save & close.
I then come back to our active machine workbook and shift a new batch into the "manufacturing cells" to begin another job.

The discussion is this:

By me having this endless loop it does seem to (crash-not responding) every 24-32 hours or so. What can be done?
Keeping in mind I need to continuously check these Cells to determine if "1" is found to begin the move process against each machine.

Each machine also has it's own segregated sheet.

Luke
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
When you don't get a response it means your question is not clear and you should reformulate. There are hundreds of hungry people competing to answer fast.

"By me having this endless loop it does seem to (crash-not responding) every 24-32 hours or so." is not a sentence.

Try to insert the statement "DoEvents" somewhere within the loop, then the program will be responsive to other events (such as clicking on a button).
 
Upvote 0
How are you looping?

G'day Norie,

Code:
Sub Timercontrol()


  With Application


               .ScreenUpdating = False
                .EnableEvents = False
                End With


    
        If v = 1 Then Exit Sub

        If v = 0 Then


    'TimeToRun = Now + TimeValue("00:00:07")
    Application.OnTime TimeToRun, "FormulaPaste"
    End If
    End Sub

Which calls a slew of code - doing IF statement is TRUE Then copy/paste save/close to different workbooks.

Which calls another machine with the exact same function.

10-12 times across 20 sub routines or so.

Then it CALLS TIMERCONTROL to start again on an indefinite loop.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top