ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I display calendar days in a row (https://www.excelbanter.com/excel-programming/328023-how-do-i-display-calendar-days-row.html)

Vern H.

How do I display calendar days in a row
 
How do I display calendar days in a row for a complete month instead of colums?
Need help with a customize function.

Toppers

How do I display calendar days in a row
 

Hi,
Dates are in UK (DD/MM/YYYY) format -


Sub TestDate()
Call DaysinMonth(9, 2005)
End Sub

Sub DaysinMonth(ByVal M As Integer, ByVal Y As Integer)

Dim c As Integer, lastDay As Integer

lastDay = Day(DateSerial(Y, M + 1, 0)) ' Calculate number of days in Month

Rows(1).ClearContents ' Clear row 1 of dates

Cells(1, 1) = DateValue("1" & Str(M) & Str(Y)) ' Set first day of month in A1
For c = 2 To lastDay ' Increment each day until end of month .. B1, C1 etc
Cells(1, c) = Cells(1, c - 1) + 1
Next c
End Sub

HTH

"Vern H." wrote:

How do I display calendar days in a row for a complete month instead of colums?
Need help with a customize function.



All times are GMT +1. The time now is 11:59 PM.

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