How to use While Wend Loop in Excel VBA? Last Updated : 19 Jul, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we are going to see about While Wend loop in Excel VBA using a suitable example. Implementation : In the Microsoft Excel tabs, select the Developer Tab. Initially, the Developer Tab may not be available. The Developer Tab can be enabled easily by a two-step process : Right-click on any of the existing tabs in the top of the Excel window.Now select Customize the Ribbon from the pop-down menu.In the Excel Options Box, check the box Developer to enable it and click on OK. Now, the Developer Tab is visible. Now click on the Visual Basic option in the Developer tab and make a new module to write the program using the Select Case statement. Developer -> Visual Basic -> Tools -> MacrosNow create a Macro and give any suitable name. This will open the Editor window where can write the code. While Wend Loop In a while loop all the statements will execute inside the loop until the provided condition becomes FALSE. The loop terminates only when the condition becomes FALSE. In Excel the keyword While is used to start the while loop and Wend is used to end the while loop. 1. The statements inside the while loop execute when the condition is TRUE. 2. When the condition is FALSE, the loop terminates and the control moves to the line after the keyword Wend. The syntax is : While boolean_condition(s)/expression(s) Statement 1 Statement 2 Statement 3 ... Statement n Wend Flow Diagram Example : Print the age of all the employees in an organization whose age falls between thirty to forty years. Code : Sub While_Age_Emp() 'Initialize and declare the age of the employee Dim Age As Integer: Age = 30 'Condition to print the age of employees between 30 to 40 years While Age < 39 Age = Age + 1 MsgBox ("Age:" & Age) Wend End Sub The condition for the above code is Age < 39. When the age of the employee becomes 40 the condition becomes FALSE and the loop terminates. So, it will print the ages from 31 to 39 respectively in the message box of Excel. Output : Age : 31 Age : 32 Age : 33 Age : 34 Age : 35 Age : 36 Age : 37 Age : 38 Age : 39 Comment More infoAdvertise with us Next Article How to use While Wend Loop in Excel VBA? rishabhchakrabortygfg Follow Improve Article Tags : Excel ExcelGuide Similar Reads How to Use Do While Loop in Excel VBA? A Doâ¦While loop is used when we want to repeat certain set of statements as long as the condition is true. The condition may be checked at the starting or at the end of the loop Flowchart: Uses of Do-While loop: The Do While loop is used in two ways: Doâ¦while loop which checks the condition at the S 2 min read How to Use For Next Loop in Excel VBA? If you are familiar with the programming you must have an idea of what a loop is, In computer programming, a loop is a sequence of statements that are repeated until a specific condition is satisfied. In Excel VBA the "For Next" loop is used to go through a block of code a specific number of times. 4 min read How to use Do Until Loop in Excel VBA? In this article, we are going to see look into the Do Until loop in Excel VBA using a suitable example. Implementation : In the Microsoft Excel tabs, select the Developer Tab. Initially, the Developer Tab may not be available. The Developer Tab can be enabled easily by a two-step process : Right-cli 3 min read How to Use for Each Loop in Excel VBA? A For Each loop is used to execute a statement or a set of statements for each element in an array or collection. Syntax: For Each element In group [ statements ] [ Exit For ] [ statements ] Next [ element ] The For...Each...Next statement syntax has the following three parts: PartDescriptionelement 3 min read How to Use the VBA Immediate Window in Excel? The immediate window is similar to the console in Chrome, where we could execute the javascript. The immediate window allows us to execute macro code very fast and efficiently. Once, you learned it, you will always be found using it. Your immediate window can answer an infinite number of questions, 5 min read Do While loop in Objective-C Just like other programming languages Objective-C also supports do..while loop. do..while loop is also known as an inverted while loop because, in a while loop, the expression is evaluated before executing the code present inside the body of the while loop, if the expression is false, then this loop 3 min read How to Use Solver in Excel? A solver is a mathematical tool present in MS-Excel that is used to perform calculations by working under some constraints/conditions and then calculates the solution for the problem. It works on the objective cell by changing the variable cells any by using sum constraints. Solver is present in MS- 3 min read While loop in Objective-C Just like other programming languages Objective-C also supports while loop. While loop is a loop that is used to repeat a statement or a group of statements till the given condition is true. Every time while loop checks the condition before executing its body. Or we can say that we can use a while l 3 min read How to Round With Doubles in Excel VBA The round function is used to round the floating numbers to a particular decimal value. Rounding a number, where it has a long decimal value will give a good balance between accuracy and readability. It also helps in calculation and also to get a precise result. In real life, it is useful in doing m 5 min read How to Set Variable to Cell Value in Excel VBA? Adding data to the worksheet is often done and it is essential to learn how to set variable to cell value in excel VBA. There can be instances when you want to add the same data to your worksheet. This task could easily be achieved with the help of Excel VBA variables. You can assign your cell value 5 min read Like