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

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!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Date problem

On Wed, 13 May 2009 08:56:46 -0500, "Melvin Purvis" 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Date problem

Brilliant! Thanks again.

"Ron Rosenfeld" wrote in message
...


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

--ron



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Date problem

On Wed, 13 May 2009 10:33:25 -0500, "Melvin Purvis" wrote:

Brilliant! Thanks again.


You're welcome. Glad to help. Thanks for the feedback.
--ron
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
Exel increment date problem wrt todays date. [email protected] Excel Worksheet Functions 1 November 11th 07 06:58 PM
Date Formula Problem - Leave date blank if Null Gayla Excel Worksheet Functions 5 April 24th 07 09:42 PM
Us date versus EU date problem Jan T. Excel Programming 7 October 2nd 06 07:06 PM
Date problem Cheryl Excel Discussion (Misc queries) 4 September 5th 06 03:31 PM
Date Problem Edgar[_3_] Excel Programming 1 February 17th 04 03:16 PM


All times are GMT +1. The time now is 11:47 AM.

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"