Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Check overlap sunday/weekend

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
newbie@gmail.com - 26 Sep 2007 08:08 GMT
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
Bob Phillips - 26 Sep 2007 08:19 GMT
Maybe

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

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

Signature

HTH

Bob

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

> Hi,
>
[quoted text clipped - 12 lines]
> regards,
> newbie
newbie@gmail.com - 26 Sep 2007 08:51 GMT
> Maybe
>
[quoted text clipped - 33 lines]
>
> - Show quoted text -

Hi,

Thanks. How about coding using vba?

regards,
Newbie
Bob Phillips - 26 Sep 2007 09:26 GMT
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

Signature

HTH

Bob

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

>> Maybe
>>
[quoted text clipped - 43 lines]
> regards,
> Newbie
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.