How to insert Date to spreadsheet?

sezuh

Well-known Member
Joined
Nov 19, 2010
Messages
708
HI,
i'll be greatful if anyone would help me to insert insert date for the whole year In column "A" and how to format Sat. with green,Sun. with Red colour all across the sheet.Thank you as ever for all help in advance.
Sheet3

<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 11pt; FONT-FAMILY: Calibri,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><COLGROUP><COL style="FONT-WEIGHT: bold; WIDTH: 30px"><COL style="WIDTH: 138px"><COL style="WIDTH: 65px"><COL style="WIDTH: 64px"></COLGROUP><TBODY><TR style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><TD> </TD><TD>A</TD><TD>B</TD><TD>C</TD></TR><TR style="HEIGHT: 23px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">1</TD><TD style="FONT-SIZE: 14pt">DATES</TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">2</TD><TD style="COLOR: #008080">SAT 01 JAN 2011</TD><TD style="COLOR: #008080"> </TD><TD style="COLOR: #008080"> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">3</TD><TD style="COLOR: #ff0000">SUN 02 JAN 2011</TD><TD style="COLOR: #ff0000"> </TD><TD style="COLOR: #ff0000"> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">4</TD><TD>MON 03 JAN 2011</TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">5</TD><TD>TUE 04 JAN 2011</TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">6</TD><TD>WED 05 JAN 2011</TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">7</TD><TD>THU 06 JAN 2011</TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">8</TD><TD>FRI 07 JAN 2011</TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">9</TD><TD style="COLOR: #008080">SAT 08 JAN 2011</TD><TD style="COLOR: #008080"> </TD><TD style="COLOR: #008080"> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">10</TD><TD style="COLOR: #ff0000">SUN 09 JAN 2011 </TD><TD style="COLOR: #ff0000"> </TD><TD style="COLOR: #ff0000"> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">11</TD><TD>MON 10 JAN 2011</TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">12</TD><TD>^</TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">13</TD><TD>^</TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">14</TD><TD>^</TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">15</TD><TD>up to</TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">16</TD><TD style="COLOR: #008080">SAT 31 DEC 2011</TD><TD> </TD><TD> </TD></TR></TBODY></TABLE>


KIND REGARDS
SEZUH
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
How about this macro...

Code:
Sub InsertDate()
    Dim Rng As Range
    Const NumFormat As String = "ddd dd mmm yyyy"
    Const Fm1$ = "=TEXT(A1,""ddd"")=""Sat"""
    Const Fm2$ = "=TEXT(A1,""ddd"")=""Sun"""
    Set Rng = Range("A1")
    Rng.Value = ("1/1/2011")
    Rng.NumberFormat = NumFormat
    Rng.AutoFill Destination:=Range("A1:A365"), Type:=xlFillDefault
    Columns(1).AutoFit
    With Range("A1:A365")
        With .FormatConditions
            .Delete
            With .Add(Type:=xlExpression, Formula1:=Fm1)
                .Font.ColorIndex = 4    ' <-- Change to suit
            End With
            With .Add(Type:=xlExpression, Formula1:=Fm2)
                .Font.ColorIndex = 3    ' <-- Change to suit
            End With
        End With
    End With
End Sub
 
Upvote 0
Maybe this will work for you.
I entered 1/1/2011 in A1 and Saturday in B1 then created 2 conditional format rules B1 cell value = "Sunday" RED, and another B1 cell value = "Saturday" GREEN. Then highlighted both cells & copied it down.
 
Upvote 0
Try in cell A1:

=TEXT(DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(ROW())+27),"yyyy mmmm dd dddd")

It will give you today's date in YYYY MMMM DD DDDD format. Note that plus 27 is used to give you the current date

Copy from A1 down as long as you like

Then with A1 be the active cell select all range from A1 downwards - Then go to Conditional Format and where formula is place the following formula:

=OR(RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))="Saturday",RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))="Sunday")

Choose a format that you like and it will color the dates that are Saturday or Sunday

I hope that helps you if you want to avoid VBA

George
 
Upvote 0
A correction to my proposal. You want different colors for Sundays and Saturdays, So in conditional format use half of the above formula for Sunday and half for Saturday.

That is:

RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))="Saturday"

and choose green color

RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))="Sunday"

and choose red color

George
 
Upvote 0
HI Jeff,
thanks for the code,Absolutly perfect... much obliged...:)I realy appreciate your effort and help.
Have Good night.
sezuh
 
Upvote 0
Hi George,

You are right, a macro may not be the way to go for the OP, but why such a complex formula and conditional formatting?

In A1 you can enter 1/1/2011 with a custom format of ddd dd mmm yyyy then drag down 365 rows.

Highlight range and with conditional formatting add two rules:
=Text(A1,"ddd")="Sat" >> pick font
=Text(A1,"ddd")="Sun" >> pick font
 
Upvote 0
Hi Jeff,

Well you re right :)) much simpler way there. Thanks for the tip

George



Hi George,

You are right, a macro may not be the way to go for the OP, but why such a complex formula and conditional formatting?

In A1 you can enter 1/1/2011 with a custom format of ddd dd mmm yyyy then drag down 365 rows.

Highlight range and with conditional formatting add two rules:
=Text(A1,"ddd")="Sat" >> pick font
=Text(A1,"ddd")="Sun" >> pick font
 
Upvote 0
Hi Mrbill11 and George, thanks for your response its amazing when several people offer thier help ,thats what i like about this forum.Your help much appreciated......
George if i do not want to start from today but from any earlier date what change to be done to excel formula?:confused:
sezuh
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,713
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top