Search
  • Kalpesh Agrawal

VBA Do while Loop

You may have doubt that what is the difference between do-while and for-loop because both loops do the same thing.


The difference between do-while and for loop is that when the condition is false the code run at least 1 time in the do-while loop, but in for loop the code will not run and shows error.


The above code indicates that first, we enter the data in the active sheet then declare the variable x as an integer.


Now, we enter in the loop and put the condition that when the cell in the first column is not empty enter the value of cell 1 + “Basics” to the first cell in the second column.


This will continue till when the condition is right, when the cell is empty, you will be out of the loop and the code will not run further.



0 comments

Recent Posts

See All