joyacv2
asked on
timed loop in excel
Hi,
I have the following code:
I want to run this code in the background while i do other things in my workbook, but this code freezes all the worksheets and the workbook, what i can do? How i can run codes in the background while modifying part of the worksheet?
I have the following code:
private sub Workbook_Open()
do while f <> 100
application.ontime now + timeserial(0,0,5) , "test"
loop
end sub
sub test()
x = x +1
sheet1.cells(x,1).value = x + 2
end sub
I want to run this code in the background while i do other things in my workbook, but this code freezes all the worksheets and the workbook, what i can do? How i can run codes in the background while modifying part of the worksheet?
ASKER
f is a variable that nevers reach 100, so the loop is forever,
test is in a module
x starts at 0
What and where is necessary the doevents?
test is in a module
x starts at 0
What and where is necessary the doevents?
ASKER
the code will modify part of the sheet while the user is changing other parts of the sheet
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
works excellent, and give me a lots of ideas!!!, Thanks!!!
your welcome my pleasure glad I could help.
gowflow
gowflow
What is f ?
where do you put your code test in a module or where ?
x in test is declared in a module as the way you posted the code each time test starts x = 0 is this what you want ???
and most of all your missing doevents reason why the whole thing freezes but still ur code does not make sense as f is not initialized somewhere else.
Best is to say what you want then will put the code for you.
gowflow