Excel - get the day of week from a date

Asked By MJKelly on 02-Nov-08 02:21 AM
Hi,

I am using a variable to hold the day of the week for a given day

Dim DayOfWeek As Date
DayOfWeek = ThisWorkbook.Sheets("Menu").Range("D2").Value

If the value of this cell is a date, how can I have the variable hold
the name of the day of the week?  I want to use this to add the day
name to a filename ie Monday Report.xls.

Any ideas?

Kind regards,
Matt




Bob Phillips replied on 31-Oct-08 10:39 AM
DayOfWeek = Format(ThisWorkbook.Sheets("Menu").Range("D2").Value,"dddd")


--
__________________________________
HTH

Bob
Mike replied on 31-Oct-08 10:47 AM
Hi,

Try this

Dim DayOfWeek As String
DayOfWeek =
WeekdayName(Weekday(ThisWorkbook.Sheets("Menu").Range("D2").Value))

Mike
Mike replied on 31-Oct-08 10:51 AM
I forgot the other arguments

DayOfWeek =
WeekdayName(Weekday(ThisWorkbook.Sheets("Menu").Range("D2").Value), 0, 1)

Mike