![]() |
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 |
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 |
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 |
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 |
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 |
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