VBA loop to duplicate rows based number of days per month

mybyby

New Member
Joined
Mar 18, 2018
Messages
1
Hi guys

I need your help guys to write VBA code to duplicate rows based on number of days per months
I have monthly order number but it is not comparable to daily actuals, what I need is to populate the table into daily file based on number days per month. e.g. I need 31 rows for first data below.

Appreciate your help. Thanks!


[TABLE="width: 500"]
<tbody>[TR]
[TD]Customer Name[/TD]
[TD]EOMDate[/TD]
[TD]OrderQty[/TD]
[TD]Remarks[/TD]
[TD]No of Days per month[/TD]
[TD]DailyTarget (OrderQtyMth/No of days)[/TD]
[/TR]
[TR]
[TD]AAAA[/TD]
[TD]31/1/2017[/TD]
[TD][TABLE="width: 67"]
<tbody>[TR]
[TD="class: xl65, width: 67"]17689[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]Store1[/TD]
[TD]31[/TD]
[TD][TABLE="width: 67"]
<tbody>[TR]
[TD="width: 67, align: right"]570.6129[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]AAAA[/TD]
[TD]28/02/2017[/TD]
[TD][TABLE="width: 67"]
<tbody>[TR]
[TD="class: xl65, width: 67"]1,806[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]Store1[/TD]
[TD]28[/TD]
[TD][TABLE="width: 67"]
<tbody>[TR]
[TD="width: 67, align: right"]64.5[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]BBBB[/TD]
[TD]31/1/2017[/TD]
[TD][TABLE="width: 102"]
<tbody>[TR]
[TD="class: xl65, width: 102"]22,029[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]Store1[/TD]
[TD]31[/TD]
[TD][TABLE="width: 67"]
<tbody>[TR]
[TD="width: 67, align: right"]710.6129[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD]BBBB[/TD]
[TD]28/02/2017[/TD]
[TD][TABLE="width: 102"]
<tbody>[TR]
[TD="class: xl65, width: 102"]2,500[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]Store1[/TD]
[TD]28[/TD]
[TD][TABLE="width: 67"]
<tbody>[TR]
[TD="width: 67, align: right"]89.28571[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi,

In column "No of Days per month":

=DAY(EOMONTH("EOMDate",0))

Replace "EOMDate" with the matching cell

Or if EOMDate is already the end of the month, just do :

=DAY("EOMDate")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top