Sub CalendarFormats()
Dim csheet As Worksheet
Set csheet = ThisWorkbook.ActiveSheet
Dim firstD As Integer
firstD = 0
'Setting up the calendar's date format
Range("C2,C8,C14") = "Sunday"
Range("C2").Select
Selection.AutoFill Destination:=Range("C2:P2"), Type:=xlFillDefault
Range("C8").Select
Selection.AutoFill Destination:=Range("C8:P8"), Type:=xlFillDefault
Range("C14").Select
Selection.AutoFill Destination:=Range("C14:P14"), Type:=xlFillDefault
'Computing plotting days of the month in correct places
selDate = [H1]
fMon = DateSerial(Year(selDate), Month(selDate), 1)
lMon = CDate(Application.WorksheetFunction.EoMonth(fMon, 0))
stRow = 3
'declaration of cell where the 1st day of Month begins
If Weekday(fMon) = 1 Then
stCol = 3
ElseIf Weekday(fMon) = 2 Then
stCol = 4
ElseIf Weekday(fMon) = 3 Then
stCol = 5
ElseIf Weekday(fMon) = 4 Then
stCol = 6
ElseIf Weekday(fMon) = 5 Then
stCol = 7
ElseIf Weekday(fMon) = 6 Then
stCol = 8
ElseIf Weekday(fMon) = 7 Then
stCol = 9
End If
For x = 1 To Day(fMon)
If firstD = Empty Then
csheet.Cells(stRow, stCol) = fMon
Else
fMon = fMon + 1
csheet.Cells(stRow, stCol) = fMon
End If
Next x
End Sub