Assuming you have the month names in row 1 in columns 1 to 12 then
Sub BuildCalendar()
Dim dt As Date
Dim cell As Range
Dim last As Long, i As Long
Range("A2").Resize(31, 12).ClearContents
For Each cell In Range("A1:L1")
dt = DateValue(cell.Value & " 1, " & Year(Date))
last = Day(DateSerial(Year(dt), Month(dt) + 1, 0))
For i = 1 To last
cell.Offset(i, 0) = i
Next
Next
End Sub
If that isn't exactly what you want, maybe you can see the pieces you need
from within it.
--
Regards,
Tom Ogilvy
"MacroLearning" wrote:
> I have a spreadsheet that is updated monthly.
>
> There is one column per month.
>
> How do I create a macro that will insert the numbers in the correct column.
>
> For example, once the September is filled in, I now want to fill in the
> October column.
>
> Any suggestions?
|