VBA - create a Loop to distribute dates along a year as per Maintenance frequency

Luthius

Active Member
Joined
Apr 5, 2011
Messages
324
Guys
I have the scenario below where I would like to create a loop to distribute along the columns (G column on) the date that that maintenance will ocurr based on its ID, Frequency and Due date. I will distribute it for a period of 01 year (365 days or 365 Columns)

For instance, the Maintenance for the ID 9960000192374 ocurrs every week and every month (Different maintenance , so my loop will fill an "x" the next due date to 08th Jan, and the next to 15th Jan, etc until reach the last week of a period of a year. After it, will go to the next row performing the next distribution.


The frequency varies, based on values of the frequency column.


[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Equipment[/TD]
[TD]Discipline[/TD]
[TD]Maintenance[/TD]
[TD]Frequency[/TD]
[TD]Due date[/TD]
[TD]01/Jan/18[/TD]
[TD]02/Jan/18[/TD]
[TD](...)[/TD]
[/TR]
[TR]
[TD]996000019374[/TD]
[TD]Equipment A[/TD]
[TD]Mechanical[/TD]
[TD]A[/TD]
[TD]1 Week[/TD]
[TD]01/01/2018[/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]996000019374[/TD]
[TD]Equipment A[/TD]
[TD]Instrumentation[/TD]
[TD]B[/TD]
[TD]1 Month[/TD]
[TD]01/01/2018[/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]996000019238[/TD]
[TD]Equipment C[/TD]
[TD]Electrical[/TD]
[TD]C[/TD]
[TD]3 Months[/TD]
[TD]01/01/2018[/TD]
[TD]X[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]











The original file contains more than 10k lines, the above table, is a short version of the problem.

Excel Columns reference based on above table:
ID= Column A
Due Date= Column F
(..) Means the others dates until 31st December

How can develop a loop that can distribute these dates?
 
Re: VBA - Help on create a Loop to distribute dates along a year as per Maintenance frequency

I would like to say thank you very much for everyone that tried to assist me.
A highlighted thanks for Mr gmhumphr and of course another special one to Mr MickG for all additional time spent to develop the code and for his patience as well.

This is the best forum ever

Thank you very much
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Re: VBA - Help on create a Loop to distribute dates along a year as per Maintenance frequency

Thank for your kind response
You're very welcome
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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