Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Check overlap sunday/weekend

Hi,

I have a query on the overlap sunday for last week of sunday/weekend
and first week sunday/weekend.

For example, 30th June 2007 is considered last week of sunday/weekend
and I have tasks: XYZ that need to exceute it. But on 1st July 2007,
it is considered as first sunday/weekend and I have another tasks: ABC
to run on this date.

Please advise on how to check this using vba.

Thanks.

regards,
newbie

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Check overlap sunday/weekend

Maybe

=IF(AND(WEEKDAY(date_cell)=7,MONTH(date_cell)<MON TH(Date_cell+1)), ... for
the Sat and


=IF(AND(WEEKDAY(date_cell)=1,MONTH(date_cell-1)<MONTH(Date_cell)), ... for
the Sun

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

" wrote in message
ups.com...
Hi,

I have a query on the overlap sunday for last week of sunday/weekend
and first week sunday/weekend.

For example, 30th June 2007 is considered last week of sunday/weekend
and I have tasks: XYZ that need to exceute it. But on 1st July 2007,
it is considered as first sunday/weekend and I have another tasks: ABC
to run on this date.

Please advise on how to check this using vba.

Thanks.

regards,
newbie



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Check overlap sunday/weekend

On Sep 26, 3:19 pm, "Bob Phillips" wrote:
Maybe

=IF(AND(WEEKDAY(date_cell)=7,MONTH(date_cell)<MON TH(Date_cell+1)), ... for
the Sat and

=IF(AND(WEEKDAY(date_cell)=1,MONTH(date_cell-1)<MONTH(Date_cell)), ... for
the Sun

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

" wrote in message

ups.com...



Hi,


I have a query on the overlap sunday for last week of sunday/weekend
and first week sunday/weekend.


For example, 30th June 2007 is considered last week of sunday/weekend
and I have tasks: XYZ that need to exceute it. But on 1st July 2007,
it is considered as first sunday/weekend and I have another tasks: ABC
to run on this date.


Please advise on how to check this using vba.


Thanks.


regards,
newbie- Hide quoted text -


- Show quoted text -


Hi,

Thanks. How about coding using vba?

regards,
Newbie

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Check overlap sunday/weekend

Dim myDate As Date
Dim LastWeek As Boolean
Dim FirstWeek As Boolean

myDate = DateSerial(2007, 6, 30)
LastWeek = Weekday(myDate) = 7 And Month(myDate) < Month(myDate + 1)
FirstWeek = Weekday(myDate) = 1 And Month(myDate - 1) < Month(myDate +
1)
MsgBox "Date " & myDate & ": " & vbNewLine & _
vbTab & "Firstweek = " & FirstWeek & vbNewLine & _
vbTab & "Lastweek = " & LastWeek

myDate = DateSerial(2007, 7, 1)
LastWeek = Weekday(myDate) = 7 And Month(myDate) < Month(myDate + 1)
FirstWeek = Weekday(myDate) = 1 And Month(myDate - 1) < Month(myDate +
1)
MsgBox "Date " & myDate & ": " & vbNewLine & _
vbTab & "Firstweek = " & FirstWeek & vbNewLine & _
vbTab & "Lastweek = " & LastWeek

myDate = Date
LastWeek = Weekday(myDate) = 7 And Month(myDate) < Month(myDate + 1)
FirstWeek = Weekday(myDate) = 1 And Month(myDate - 1) < Month(myDate +
1)
MsgBox "Date " & myDate & ": " & vbNewLine & _
vbTab & "Firstweek = " & FirstWeek & vbNewLine & _
vbTab & "Lastweek = " & LastWeek


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

" wrote in message
ps.com...
On Sep 26, 3:19 pm, "Bob Phillips" wrote:
Maybe

=IF(AND(WEEKDAY(date_cell)=7,MONTH(date_cell)<MON TH(Date_cell+1)), ...
for
the Sat and

=IF(AND(WEEKDAY(date_cell)=1,MONTH(date_cell-1)<MONTH(Date_cell)), ...
for
the Sun

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

" wrote in message

ups.com...



Hi,


I have a query on the overlap sunday for last week of sunday/weekend
and first week sunday/weekend.


For example, 30th June 2007 is considered last week of sunday/weekend
and I have tasks: XYZ that need to exceute it. But on 1st July 2007,
it is considered as first sunday/weekend and I have another tasks: ABC
to run on this date.


Please advise on how to check this using vba.


Thanks.


regards,
newbie- Hide quoted text -


- Show quoted text -


Hi,

Thanks. How about coding using vba?

regards,
Newbie



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
Determining the Sunday date of the third "full" weekend of a month Bob Excel Worksheet Functions 25 September 13th 09 07:26 PM
Friday as weekend instead of Saturday & Sunday Naushad Excel Worksheet Functions 3 March 14th 09 08:22 AM
Check to see if date is = to Sunday Brian Excel Programming 1 June 19th 06 03:37 AM
Check to see if date is = to Sunday Brian Excel Programming 1 June 19th 06 03:22 AM
Check to see if date is = to Sunday Brian Excel Programming 0 June 19th 06 02:53 AM


All times are GMT +1. The time now is 10:51 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"