get the day of week from a date

M

MJKelly

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
 
M

Mike H

Hi,

Try this

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

Mike
 
M

Mike H

I forgot the other arguments

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

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top