How To Repeat Tasks With Your VBA Code

This post is actually an answer to a question on a youtube video

“I am facing one problem during working with excel, how do I solve below….. Serial number in row:1,2,3,4………… Required no of repit :2,1,3,2………… Answer will be : 1,1,2,3,3,3,4,4…….. How do I solve this problem??? Where one and another dejit will repit continuously.. Please help to find a way to solve this problem. Thank you.”

Here is the setup:

For this we are going to use a for loop to loop the cells and another for loop to insert the results.

Paste this code into a module, and we’ll call it from a button on the worksheet.


Please remember to subscribe to my youtube channel

Been helped? Get these!