Hi ,
The first thing to understand is that a loop , in any programming language , needs to have a way to break out of the loop. Otherwise , you will have what is known as an infinite loop , which continues forever , without end.
The second is that before you program any situation , just work it out for yourself , by hand , and visualize how the computer will carry out each step through the program.
1. You are selecting a particular cell using the Range("A1").Select statement
2. You are specifying that the cell will be put to the text "Microsoft".
3. You are checking to see whether the cell contains the text "excel" ; since you have through the earlier statement , made the cell contain the text "Microsoft" , this check will return a FALSE value.
4. Since you are using a DO UNTIL loop , the computer will repeat step 3 again and again , waiting for the result to be TRUE. Since nothing within the program can change the contents of the cell A1 from "Microsoft" to "excel" , the computer will never exit from the loop. To the user , it will appear as if the computer has hung , but it is merely continuing with its check , executing the DO UNTIL loop again and again.
5. When you code any loop , remember the following :
a) A DO WHILE loop keeps executing the steps within the loop as long as the condition it is checking for is TRUE ; for the computer to exit the loop , some part of the code ( between the DO WHILE statement and the LOOP statement ) has to make the condition FALSE.
b) A DO UNTIL loop keeps executing the steps within the loop as long as the condition it is checking for is FALSE ; for the computer to exit the loop , some part of the code ( between the DO UNTIL statement and the LOOP statement ) has to make the condition TRUE.
Narayan