PDA

View Full Version : Solved: Calendar



sasa
05-05-2008, 07:18 AM
Because of my work I must every month to plan a monthly calendar.
It is very simple: in A1 I must insert the date (01/05/2008) in b1 the day of the week (thursday). I am wondering if it possible with a macro once I insert my first
data (a1=date) b1= (day) to get the full month, dates in column a, days in column b.

Thanks for every help

Sasa

rangudu_2008
05-05-2008, 07:39 AM
You use this file and add the code to display the week day...

Click the cell B3 and check it out... Modify it for ur own purposes...

georgiboy
05-05-2008, 09:29 AM
Is this what you are after
Sub x()
Dim MonthStop As String
MonthStop = Month(Range("A1").Value)
Dim MyRange As Range, rCell As Range
Set MyRange = Range("A1:A35")
For Each rCell In MyRange.Cells
If Month(rCell.Value) = MonthStop Then
rCell.Offset(, 1).Value = Weekday(rCell.Value)
rCell.Offset(1, 0) = rCell.Value + 1
If Month(rCell.Offset(1, 0).Value) > MonthStop Then rCell.Offset(1, 0).ClearContents
End If
Next rCell
End Sub
hope this helps

Bob Phillips
05-05-2008, 10:59 AM
Public Sub MyCalendar()

With ActiveSheet

.Range("A1").Value = Date - Day(Date) + 1
.Range("A1").AutoFill .Range("A1").Resize(31, 1)

With .Range("A29:A31")

.Select
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MONTH(A29)<>MONTH($A$1)"
.FormatConditions(1).Font.ColorIndex = 2
End With
End With
End Sub

sasa
05-05-2008, 09:50 PM
thank you, another brick in my work.