ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Day of the Week from Date (https://www.excelbanter.com/excel-programming/340270-day-week-date.html)

Greg Billinge

Day of the Week from Date
 
Hi,

I need to work out what day of the week it is from a date value. I know you
can show it in formatting but i need to set the value of a variable in my
macro to Monday, Tuesday etc.

Any help is really appreciated.

Thanks

Greg

Stefi

Day of the Week from Date
 
yourvariable =Worksheetfunction.TEXT(A1;"dddd")

where A1 contains the date value.

Regards,
Stefi

€˛Greg Billinge€¯ ezt Ć*rta:

Hi,

I need to work out what day of the week it is from a date value. I know you
can show it in formatting but i need to set the value of a variable in my
macro to Monday, Tuesday etc.

Any help is really appreciated.

Thanks

Greg


Bob Phillips[_6_]

Day of the Week from Date
 
=TEXT(A1,"dddd")

--
HTH

Bob Phillips

"Greg Billinge" wrote in message
...
Hi,

I need to work out what day of the week it is from a date value. I know

you
can show it in formatting but i need to set the value of a variable in my
macro to Monday, Tuesday etc.

Any help is really appreciated.

Thanks

Greg




Don Guillett[_4_]

Day of the Week from Date
 
try

Sub dodate()
myvar = Format(Range("g19"), "ddd")
MsgBox myvar
If myvar = "Fri" Then MsgBox "OK"
End Sub

or shortened

if Format(Range("g19"), "ddd")="Fri" then msgbox "OK"


--
Don Guillett
SalesAid Software

"Greg Billinge" wrote in message
...
Hi,

I need to work out what day of the week it is from a date value. I know

you
can show it in formatting but i need to set the value of a variable in my
macro to Monday, Tuesday etc.

Any help is really appreciated.

Thanks

Greg




Harald Staff

Day of the Week from Date
 
Hi Greg

Uppercase first letter and all:

Sub test()
Dim Dt As Date
Dim sDay As String

Dt = Date
sDay = StrConv(Format$(Dt, "dddd"), vbProperCase)

End Sub

Note that this, and the other provided solutions, returns day names based on
the computer's regional settings, so it'll say Vendredi in France, not
Friday.

HTH. Best wishes Harald


"Greg Billinge" skrev i melding
...
Hi,

I need to work out what day of the week it is from a date value. I know
you
can show it in formatting but i need to set the value of a variable in my
macro to Monday, Tuesday etc.

Any help is really appreciated.

Thanks

Greg




Brian

Day of the Week from Date
 
try using Excel's WEEKDAY function.

"Greg Billinge" wrote:

Hi,

I need to work out what day of the week it is from a date value. I know you
can show it in formatting but i need to set the value of a variable in my
macro to Monday, Tuesday etc.

Any help is really appreciated.

Thanks

Greg



All times are GMT +1. The time now is 05:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com