PC Review


Reply
Thread Tools Rate Thread

Date problem

 
 
Melvin Purvis
Guest
Posts: n/a
 
      13th May 2009
Hello,

I am using a variable to delete rows in a large spreadsheet.

Dim StartDate As Date
Dim EndDate As Date
StartDate = Now
EndDate = Workday(StartDate, 1)

I need to change EndDate so that whatever StartDate is, EndDate is the 2nd
Friday after that, unless StartDate is a Friday, in which case I need
EndDate to be the 1st Friday after that.

Can anybody change my verbage into the code needed? I've been struggling
with it for awhile now.

Many thanks in advance!


 
Reply With Quote
 
 
 
 
Ron Rosenfeld
Guest
Posts: n/a
 
      13th May 2009
On Wed, 13 May 2009 08:56:46 -0500, "Melvin Purvis" <(E-Mail Removed)> wrote:

>Hello,
>
>I am using a variable to delete rows in a large spreadsheet.
>
>Dim StartDate As Date
>Dim EndDate As Date
>StartDate = Now
>EndDate = Workday(StartDate, 1)
>
>I need to change EndDate so that whatever StartDate is, EndDate is the 2nd
>Friday after that, unless StartDate is a Friday, in which case I need
>EndDate to be the 1st Friday after that.
>
>Can anybody change my verbage into the code needed? I've been struggling
>with it for awhile now.
>
>Many thanks in advance!
>



EndDate = StartDate + 14 - Weekday(StartDate + 1, vbSunday)

--ron
 
Reply With Quote
 
Melvin Purvis
Guest
Posts: n/a
 
      13th May 2009
Brilliant! Thanks again.

"Ron Rosenfeld" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
>
> EndDate = StartDate + 14 - Weekday(StartDate + 1, vbSunday)
>
> --ron



 
Reply With Quote
 
Ron Rosenfeld
Guest
Posts: n/a
 
      13th May 2009
On Wed, 13 May 2009 10:33:25 -0500, "Melvin Purvis" <(E-Mail Removed)> wrote:

>Brilliant! Thanks again.


You're welcome. Glad to help. Thanks for the feedback.
--ron
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
::: Date Comparison Problem or Date Formula or Date Macro ::: infojacques@gmail.com Microsoft Excel Discussion 3 13th Jul 2007 10:08 AM
[Newbie UK Date problem] Ways atround this UK date format localisation/SQLselection issue? DC Microsoft ASP .NET 5 1st Jul 2005 10:35 PM
[Newbie UK Date problem] Ways atround this UK date format localisation/SQLselection issue? DC Microsoft C# .NET 5 1st Jul 2005 10:35 PM
Formatting Problem-Highlighting a cell when date has expired past current date alancyoung Microsoft Excel Misc 1 19th Feb 2004 05:14 PM
Date Range: Between [Start Date] and [End Date] problem KL Microsoft Access Queries 4 16th Dec 2003 02:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:24 PM.