ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Generate calendar column month headers in YYMM Format (https://www.excelbanter.com/excel-programming/421724-generate-calendar-column-month-headers-yymm-format.html)

u473

Generate calendar column month headers in YYMM Format
 
From the given First Month and Last Month dates, for instance
11/15/2008 and 03/20/2009,
how do I loop and generate with VBA the columns headers of 0811,
0812, 0901, 0902, 0903.
Thank you for your help.
J.P.

Mike H[_3_]

Generate calendar column month headers in YYMM Format
 
Hi,

Right click your sheet tab, view code and paste the code below in and
run it. It picks up startdate and enddate from a1 and B1 respectively

Sub FillCalendar()
Dim startdate As Date, enddate As Date
startdate = Range("A1").Value
enddate = Range("B1").Value
x = 1
Do
With Cells(2, x)
.Value = startdate
.NumberFormat = "mmyy"
End With
startdate = DateAdd("m", 1, startdate)
x = x + 1
Loop Until startdate enddate
End Sub

Mike

On Dec 26, 9:25*am, u473 wrote:
From the given First Month and Last Month dates, for instance
11/15/2008 and 03/20/2009,
*how do I loop and generate with VBA the columns headers of *0811,
0812, 0901, 0902, 0903.
Thank you for your help.
J.P.



u473

Generate calendar column month headers in YYMM Format
 
Thank you very much. Your answer was very much appreciated.
Assuming that I push that calendar 2 columns to the right and have a
column
of unique dates in A, and Values in B column, like :
A B
11/15/2008 15,000
12/25/2008 8,000
02/05/2009 12,000
How do I distribute these values in their respective columns ?
I know I have to loop thru the range in column A, but how do I refer
to the appropriate column ?
Thank you again and have Happy Holidays !
J.P.


All times are GMT +1. The time now is 10:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com