• Kalpesh Agrawal

VBA For loop- Message Box

This topic is very important, as this will makes the work easy if you want to do the same process again and again.

For loop condition is based on the number condition, it will keep on executing several times.

You can write the code given below to show the message box.

So, the simple understanding of the above code is that when you want the message box on the screen that displays 1 to 20 numbers one-by-one, then you can use the function for loop.

If you write the code for all message boxes one-by-one you have to write 20 lines of code, which wastes your time. You can show any other message on the screen, like rather than showing these numbers, you can show any constant number or word 20 times.

Related: Excel VBA common basic questions
Related: How to Record, Run and Save Macro
Related: How to add VBA to the Excel


Recent Posts

See All