Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 14th, 2007, 08:39 PM
Authorized User
Join Date: Mar 2007
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default month comparison,update status to 'Due Soon'

    Pls kindly help.. i need to write the formula using vb, such as if the data's date is within next 3 months, i need to set the status of the action item to 'Due soon'.
Eg) Today is in the month of may, so any dates in the data from May->July should have a status set to 'Due Soon'..


Reply With Quote
  #2 (permalink)  
Old May 14th, 2007, 11:33 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts

Here you have miracles

Sub Check_Date_Within_3_Months()

Dim CurrentDate As Date
Dim ThirdMonthDate As Date
Dim D1Date As Date

On Error Resume Next

CurrentDate = Now
ThirdMonthDate = DateAdd("m", 3, CurrentDate)
D1Date = "2007/06/15"

If DateDiff("d", CurrentDate, D1Date) > 0 And DateDiff("d", ThirdMonthDate, D1Date) < 0 Then
    MsgBox "Date is within the period"
    'Set action to Due Soon
    MsgBox "Date is outside the period"
End If

End Sub


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting month name to month number kalyanykk SQL Server 2005 7 August 19th, 2008 10:37 PM
Need date comparison and month from same db field scottiegirl PHP Databases 13 December 1st, 2007 12:43 PM
Text Box too wide due to value? Ron Howerton HTML Code Clinic 0 May 7th, 2007 01:34 PM
query Current Month, Month+1, Month+2, Month+3 anterior Access 2 September 24th, 2006 08:25 PM
Might this be a logic error due to the code? Ben Horne Javascript 1 November 30th, 2004 08:59 PM

All times are GMT -4. The time now is 11:42 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.