Creating rows automatically based on value limit in Microsoft Excel -


i want create carton based on maximum unit per carton particular item.

eg.

item    quantity    maxqtypercarton          12            5 b           6            3 

this should give results follows creating rows in excel

item    cartonquantity          5          5          2 b          3 b          3 

you can see item quantity has been divided 3 rows based on maxqtypercarton. also, item b has been divided 2 rows based on maxqtypercarton.

any idea on this?

the vba approach (just programming it)

option explicit  sub sub1()   dim irow1&, irow2&, zitem$, zquan&, zmaxq&, zamt&   irow2 = 10 ' ??   irow1 = 2 3 ' ??      zitem = cells(irow1, 1)      zquan = cells(irow1, 2)      zmaxq = cells(irow1, 3)      while zquan > 0        zamt = zquan        if zamt > zmaxq zamt = zmaxq        cells(irow2, 1) = zitem        cells(irow2, 2) = zamt        irow2 = irow2 + 1        zquan = zquan - zamt      loop   next irow1 end sub 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -