Solved

timed loop in excel

Posted on 2013-06-21
6
184 Views
Last Modified: 2013-06-21
Hi,

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

Open in new window


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?
0
Comment
Question by:joyacv2
  • 3
  • 3
6 Comments
 
LVL 29

Expert Comment

by:gowflow
ID: 39266523
for sure

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
0
 
LVL 1

Author Comment

by:joyacv2
ID: 39266542
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?
0
 
LVL 1

Author Comment

by:joyacv2
ID: 39266546
the code will modify part of the sheet while the user is changing other parts of the sheet
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Accepted Solution

by:
gowflow earned 500 total points
ID: 39266618
I made up a sample for you try it just use intuition

let me know your comments.
gowflow
ontime.xls
0
 
LVL 1

Author Closing Comment

by:joyacv2
ID: 39266635
works excellent, and give me a lots of ideas!!!, Thanks!!!
0
 
LVL 29

Expert Comment

by:gowflow
ID: 39267038
your welcome my pleasure glad I could help.
gowflow
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question