+ Reply to Thread
Results 1 to 4 of 4

tying to code as msgbox if date is older than 30 days

Hybrid View

  1. #1
    Registered User
    Join Date
    09-24-2003
    Posts
    62

    tying to code as msgbox if date is older than 30 days

    right now I have this code, I have tried variations of it but can't seem to get it to work. no mater what the date is in Rng1 the msgbox appears.

    If Rng1.Value < DateAdd("m", -1, Date) Then
         If MsgBox("text if older than 30 days", vbYesNo) = vbNo Then
              ' does stuff if NO
         Elseif vbYes Then
              ' does stuff if YES
         End If
    End If

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Why not just use Conditional Formatting?

    If Rng1.Value < Date - 30 Then MsgBox "Date is over 30 days"
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    09-24-2003
    Posts
    62
    Thanks for the reply Roy,

    I tried that too. even made sure rng1 on the spread sheet is cell format to date *m/dd/yyyy

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You don't set rng1.

    Set Rng1 = Cells(1,1)
    If Rng1.Value < Date - 30 Then MsgBox "Date is over 30 days"

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1