On Jan 2, 2:09*pm, "SF" <x...@online.com.kh> wrote:
> Thank you very much,
>
> The code work very well.
>
> SF
>
> "Joe" <Joe.Varghese.J...@gmail.com> wrote in message
>
> news:4d201fc7-890c-429f-8fdf-(E-Mail Removed)...
>
>
>
> > Hi SF,
>
> > Try the code below and let me know......
>
> > Private Sub CommandButton1_Click()
> > ' Will add a sheet and put all the dates of a month in 2nd column
> > ' with weekends in Grey Color
>
> > Dim Y, M, D, WD As Variant
> > Const CGrey As Integer = 15
> > ' or Assign the color code of ur choice
>
> > M = Month(Now())
> > ' or Assign the number of the month (1, 2, ...., 12)
>
> > Y = Year(Now())
> > ' or Assign ur choice. *(2007, 2008, ...)
>
> > D = 1
>
> > Sheets.Add
> > ActiveSheet.Name = "DD"
> > 'Assign Ur text here
>
> > Do While Month(DateSerial(Y, M, D)) = M
> > * *With ActiveSheet
> > * * * *.Cells(D, 2) = DateSerial(Y, M, D)
> > * * * *WD = Weekday(.Cells(D, 2), vbMonday)
> > * * * *If WD = 6 Or WD = 7 Then _
> > * * * * * *.Cells(D, 2).Interior.ColorIndex = CGrey
> > * *End With
> > * *D = D + 1
> > Loop
>
> > End Sub
>
> > HTH
> > Joe- Hide quoted text -
>
> - Show quoted text -
Nice...
Welcome.
Joe
|