days of the current month

  • Thread starter David Gladstone
  • Start date

D

David Gladstone

Is there a simple way to fill the days of the current month, e.g.
November 1 to 30 and February 1 to 28(or 29)?
I want to create a template to record temperature, rainfall etc for
each day of the month. Ideally this would create a new worksheet,
even better if it named that sheet November 2011 etc.
Thanks in advance
 
Ad

Advertisements

D

Don Guillett

Is there a simple way to fill the days of the current month, e.g.
November 1 to 30 and February 1 to 28(or 29)?
I want to create a template to record temperature, rainfall etc for
each day of the month.  Ideally this would create a new worksheet,
even better if it named that sheet November 2011 etc.
Thanks in advance
Why not just use ONE sheet with the whole year added a month at a time
with this macro. Then use DATA>Autofilter>filter by the month

Sub AddMonthOfDaysSAS()Dim lr As LongDim numdays As DoubleIf
Len(Application.Trim(Range("a2"))) < 1 Then   Range("a2") =
DateSerial(Year(Now), 1, 1)   Range("a2").AutoFill
Destination:=Range("a2:a32")Else   lr = Cells(Rows.Count,
1).End(xlUp).Row   numdays = Day(DateSerial(Year(Cells(lr, 1)),
Month(Cells(lr, 1)) + 2, 0))   Cells(lr + 1, 1) = Cells(lr, 1) + 1 
 Cells(lr + 1, 1).AutoFill Destination:=Cells(lr + 1,
1).Resize(numdays)End IfEnd Sub
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top