Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default get the day of week from a date


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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default get the day of week from a date

DayOfWeek = Format(ThisWorkbook.Sheets("Menu").Range("D2").Val ue,"dddd")


--
__________________________________
HTH

Bob

"MJKelly" wrote in message
...

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default get the day of week from a date

Hi,

Try this

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

Mike

"MJKelly" wrote:


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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default get the day of week from a date

I forgot the other arguments

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

Mike

"Mike H" wrote:

Hi,

Try this

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

Mike

"MJKelly" wrote:


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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert regular Date to Week Ending or Week Beginning Dates Sam H Excel Discussion (Misc queries) 5 April 3rd 23 04:39 PM
Display "this week" column headers w/date & day of week? Ivan Wiegand Excel Worksheet Functions 9 September 12th 07 05:18 PM
Check if Date within this week/last week Duncan[_5_] Excel Programming 4 December 15th 06 02:37 PM
Date Function formula that will return the date of a specific week Greg Excel Worksheet Functions 4 June 12th 06 05:07 PM
I need week number in excell from a date, first week must be mini. jPeich Excel Discussion (Misc queries) 4 January 5th 05 01:21 AM


All times are GMT +1. The time now is 09:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"