PDA

View Full Version : [SOLVED:] fill months following



marreco
03-11-2014, 12:05 PM
Hi.

I'm trying, based on cells (A1 and A2).


filling columns (second row), based on the First date (month / year) and End date (month / year), in A1 and A2.

look my file.

marreco
03-11-2014, 12:30 PM
HI.

I try it .....

Sub NotWork()
Cells(2, 3).Formula = "=TEXT(A1,""mmm/aaaa"")"
Cells(2, 4).Resize(, [A2]).Formula = "=MONTH(C2)+1&""/""&YEAR(C2)"
End Sub..But doesn't work!

Thanks

ashleyuk1984
03-11-2014, 01:39 PM
Sub AshMonth()
Dim i As Integer
Dim x As Integer

x = 3

For i = Month(Range("A1")) To Month(Range("A2"))
Cells(1, x).Value = i & "/14"
x = x + 1
Next i

Range(Cells(1, 3), Cells(1, x)).NumberFormat = "mmm-yy"

End Sub

marreco
03-12-2014, 04:12 AM
Very good, i like it.

Thank you very much!