LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Code assistance

On Jan 2, 2:09*pm, "SF" wrote:
Thank you very much,

The code work very well.

SF

"Joe" wrote in message

...



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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assistance with VBA code on MAC Jim May Excel Programming 2 October 20th 06 06:57 PM
Assistance with code Please Greg B... Excel Discussion (Misc queries) 8 March 2nd 05 10:55 PM
I need assistance getting VBA code to do the following... SD Excel Programming 1 February 3rd 05 03:17 AM
Code assistance please JMay Excel Programming 3 September 4th 04 05:21 PM
VBA Code Assistance chryo Excel Programming 9 August 7th 04 12:57 AM


All times are GMT +1. The time now is 04:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"