Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default This weeks Monday


How do I get excel to recognize the date of this weeks Monday? Fo
example. I have this bit of code, (Date - 1) for tommorow or (Date
2) for wednesday to have it come up with August 29th, 2005. How do
make that for this weeks Monday no matter what day of the week it is.
Monday, Tuesday, Wednesday, Thursday or Friday?

--
DK
-----------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...fo&userid=1451
View this thread: http://www.excelforum.com/showthread.php?threadid=40017

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default This weeks Monday

=A2-(WEEKDAY(A2)-2)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"DKY" wrote in message
...

How do I get excel to recognize the date of this weeks Monday? For
example. I have this bit of code, (Date - 1) for tommorow or (Date -
2) for wednesday to have it come up with August 29th, 2005. How do I
make that for this weeks Monday no matter what day of the week it is.
Monday, Tuesday, Wednesday, Thursday or Friday??


--
DKY
------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=400172



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default This weeks Monday


So I could probably do like this then.
If Range("H2") ((A2-(WEEKDAY(A2)-2)
)-7)
and it will give me something like this?
If Range("H2") (08/22/2005

--
DK
-----------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...fo&userid=1451
View this thread: http://www.excelforum.com/showthread.php?threadid=40017

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default This weeks Monday

No you cannot use worksheet functions directly in a cell like that. You
either use worksheet functions fully

If Range("H2").Value Range("A2").Value - _
(WorksheetFunction.Weekday(Range("A2").Value) - 2) Then

or use the VBA function

If Range("H2").Value Range("A2").Value - _
Weekday(Range("A2").Value - 2) Then
MsgBox "yes"
End If

--

HTH

RP
(remove nothere from the email address if mailing direct)


"DKY" wrote in message
...

So I could probably do like this then.
If Range("H2") ((A2-(WEEKDAY(A2)-2)
)-7)
and it will give me something like this?
If Range("H2") (08/22/2005)


--
DKY
------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=400172



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default This weeks Monday


Where's A2 coming from? I'm sorry if I wasn't clear earlier but here's
what I'm looking for. I currently have this.
If Range("H2") (Date-1)
what this is going to give me (because its Tuesday) is yesterday's
(Monday's) date. Tomorrow I'm going to have to change it to this
If Range("H2") (Date-2)
to continue to get this week's Monday's date. Then on Thursday I'm
going to have to change it to this
If Range("H2") (Date-3)
to get this week's Monday's date. How do I make it so I don't have to
go into the code everytime I want to use the code and adjust my
conditional statement depending upon what day it is today. I'm
horrible with dates and I want what appears in the parenthesis to be
the date of whatever week I use the macro's Monday.


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=400172



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default This weeks Monday

A2 was just an example, a suggested cell for the date to transform to
Monday. If you just want Today, use

If Range("H2").Value Date - Weekday(Date - 2) Then
MsgBox "yes"
End If


--

HTH

RP
(remove nothere from the email address if mailing direct)


"DKY" wrote in message
...

Where's A2 coming from? I'm sorry if I wasn't clear earlier but here's
what I'm looking for. I currently have this.
If Range("H2") (Date-1)
what this is going to give me (because its Tuesday) is yesterday's
(Monday's) date. Tomorrow I'm going to have to change it to this
If Range("H2") (Date-2)
to continue to get this week's Monday's date. Then on Thursday I'm
going to have to change it to this
If Range("H2") (Date-3)
to get this week's Monday's date. How do I make it so I don't have to
go into the code everytime I want to use the code and adjust my
conditional statement depending upon what day it is today. I'm
horrible with dates and I want what appears in the parenthesis to be
the date of whatever week I use the macro's Monday.


--
DKY
------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=400172



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default This weeks Monday


I finally found something, thanks for the help anyway.

GetMondayDate = Date - Weekday(Date, vbMonday) + 1
If Range("H2") = GetMondayDat

--
DK
-----------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...fo&userid=1451
View this thread: http://www.excelforum.com/showthread.php?threadid=40017

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default This weeks Monday

That transforms Sunday to previous Monday, mine takes it to the next.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"DKY" wrote in message
...

I finally found something, thanks for the help anyway.

GetMondayDate = Date - Weekday(Date, vbMonday) + 1
If Range("H2") = GetMondayDate


--
DKY
------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=400172



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
=NameCheck - Monday??? Lost Cluster Excel Worksheet Functions 3 May 24th 10 02:28 PM
First Monday Charlie O'Neill Excel Discussion (Misc queries) 8 April 15th 10 06:09 PM
Monday Following robzrob Excel Worksheet Functions 8 September 1st 08 11:47 PM
Date calculation for Monday of one month to the Monday of the next Sunnyskies Excel Discussion (Misc queries) 19 July 2nd 07 12:08 PM
calculate weeks from a start date ( not yr weeks) Todd F. Excel Worksheet Functions 6 November 27th 04 05:53 PM


All times are GMT +1. The time now is 02:30 PM.

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

About Us

"It's about Microsoft Excel"