I'm new to VBA and can;t wrap my head around the most efficient way to do this - what I'm looking for is a way to copy my data into rows below the active cell based upon a frequency.
Sample data is like this:
Name Value Frequency Date
Steve 10 Annual 01/03/2012
Dave 25 Quarterly 01/03/2012
Sarah 10 Monthly 01/03/2012
Gavin 27 Quarterly 01/04/2012
And what I would like to do in this case is for Sarah add in all rows in one month increments until March 2013. This would mean adding in 12 rows, from April 2012 to March 2013, With the name, value and frequency remaining constant.
For Steve I would like to add in one row for March 2013 For Dave I would like to add in 3 rows (one every three months)
If the first date were to be 1st April 2012 instead, and the frequency annual. I would like to add in nothing as there is no other date before March 2013.
For the above sample the output would be:
Name Value Frequency Date
Steve 10 Annual 01/03/2012
Steve 10 Annual 01/03/2013
Dave 25 Quarterly 01/03/2012
Dave 25 Quarterly 01/07/2012
Dave 25 Quarterly 01/11/2012
Dave 25 Quarterly 01/03/2013
Sarah 10 Monthly 01/03/2012
Sarah 10 Monthly 01/04/2012
Sarah 10 Monthly 01/05/2012
Sarah 10 Monthly 01/06/2012
Sarah 10 Monthly 01/07/2012
Sarah 10 Monthly 01/08/2012
Sarah 10 Monthly 01/09/2012
Sarah 10 Monthly 01/10/2012
Sarah 10 Monthly 01/11/2012
Sarah 10 Monthly 01/12/2012
Sarah 10 Monthly 01/01/2013
Sarah 10 Monthly 01/02/2013
Sarah 10 Monthly 01/03/2013
Gavin 27 Quarterly 01/04/2012
Gavin 27 Quarterly 01/08/2012
Gavin 27 Quarterly 01/12/2012
Thanks in advance!