Results 1 to 4 of 4

Excel Macro: Ask user for date then subtract 6 months from it

Threaded View

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2013
    Posts
    87

    Excel Macro: Ask user for date then subtract 6 months from it

    Hello,

    I am trying to create a macro that will ask a user to enter a date (format is: mm/dd/yyyy)

    I then want to create a variable that will deduct 6 months from the date entered. I think I am close but not quite there. I can get the 6 months from the CURRENT date, but not the date entered by the user.

    Any help would be greatly appreciated


    Dim DateAsk As Date
    Dim DateWithin6Months As Date
    
    
    DateAsk = InputBox("Enter the Date the document was extracted in (MM-DD-YYYY) Format")
    
    
    
        DateWithin6Months = DateAdd("m", -6, Date)
        DateWithin6Months = Format(DateWithin6Months, "mm/dd/yyyy")
    Last edited by foxy_420; 03-21-2013 at 11:09 AM.

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