Quote Originally Posted by ayazgreat View Post
Dear Rick Rothstein

The macro is giving error , I am attaching here a workbook with expected result.
A B C
1 Start Range End Range Qty
2 1000394600 1000414599 20000
3 1000825600 1000845599 20000
4 1002832000 1002851999 20000

In the above snapshot from your worksheet, the two highlighted ranges overlap... is that correct? I have assumed (even in my first posted code) that the ranges link together one-to-the-other without an breaks in the ranges. Are you telling us that the ranges do not have to be contiguous throughout the table? If so, then I do not think my original code actually works for your first posted question. Please let us know about your ranges and whether they can be non-contiguous or overlap.