Automatically increase the month of a date and put it in new cells, based on a cell value?

ianwuk

New Member
Joined
Nov 20, 2018
Messages
6
Hello.

I have this spreadsheet:

35i688o.jpg


How can I make it so that, for whatever number I put in B1 it takes the date in A4 and automatically fills in rows below by increasing the months.

So, for example, if I put 3 in B1 I want it to automatically look like this:

335e3af.png


How can I do this? Is it a formula or macro?

Many thanks.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
try this in A5 and copy down

=IF((ROW(A5)-ROW($A$4))<=$B$1,EDATE(A4,1),"")
 
Upvote 0
try this in A5 and copy down

=IF((ROW(A5)-ROW($A$4))<=$B$1,EDATE(A4,1),"")

Thanks so much for replying. I will try it tomorrow. Is there any way for it to add the extra rows automatically, without having to copy down?
 
Upvote 0
if you don't want to copy down, you can even set an event when you change cell B1

try this

Code:
Sub FillMonths()
     Range("A4")=Range("B2")
     If Range(""B1")>1 Then
          Range(Range("B5"), Range("B5").Offset(Range("B2")-2, 0).FormulaR1C1= "=EDATE(R[-1]C,1)"
          Range(Range("B4"), Range("B4").Offset(Range("B2")-1, 0).NumberFormat="dd-mm-yy"
     End If
End Sub
 
Upvote 0
if you don't want to copy down, you can even set an event when you change cell B1

try this

Code:
Sub FillMonths()
     Range("A4")=Range("B2")
     If Range(""B1")>1 Then
          Range(Range("B5"), Range("B5").Offset(Range("B2")-2, 0).FormulaR1C1= "=EDATE(R[-1]C,1)"
          Range(Range("B4"), Range("B4").Offset(Range("B2")-1, 0).NumberFormat="dd-mm-yy"
     End If
End Sub

Silly question, but this would be as a new Macro, is that correct? Thanks.
 
Upvote 0
yes

you would create this macro and run it when you want to fill all the months

if you want to an automatic run of the macro when you insert the number of months you could adapt it to a change event
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

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