Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
=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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Convert regular Date to Week Ending or Week Beginning Dates | Excel Discussion (Misc queries) | |||
Display "this week" column headers w/date & day of week? | Excel Worksheet Functions | |||
Date Function formula that will return the date of a specific week | Excel Worksheet Functions | |||
Finding the Monday date based on a different date in same week | Excel Worksheet Functions | |||
I need week number in excell from a date, first week must be mini. | Excel Discussion (Misc queries) |