+ Reply to Thread
Results 1 to 11 of 11

Macro w shortcut key to paste date 28 days from today into active cell

  1. #1
    Registered User
    Join Date
    06-07-2012
    Location
    hbg,pa
    MS-Off Ver
    Excel 2003
    Posts
    38

    Macro w shortcut key to paste date 28 days from today into active cell

    I have been struggling, to figure this out but need to call in the experts.

    I would like users to be able to use a shorcut key "control + m" and have it paste the date 28 days from now. This formula works for regular (non-macro use) =TODAY()+28

    The idea is to put a DUE date in the cell that will be formatted "dd/mm". The cells where the macro will be executed are already properly date formatted, so I would like to preserve formatting and copy value only.

    Any help would be appreciated.

    Thanks

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,370

    Re: Macro w shortcut key to paste date 28 days from today into active cell

    Hi Zooka,

    See if this does it for you.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    06-07-2012
    Location
    hbg,pa
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Macro w shortcut key to paste date 28 days from today into active cell

    Thanks, Marvin

    So simple-works like a charm, and I learned something.

    Zooka (I added to your reputation)

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,370

    Re: Macro w shortcut key to paste date 28 days from today into active cell

    Thanks for the rep, BUT better yet is you learned something!!

  5. #5
    Registered User
    Join Date
    06-07-2012
    Location
    hbg,pa
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Macro w shortcut key to paste date 28 days from today into active cell

    Is there a way to modify this code such that macro will provide date 28 days from today but avoid a weekend result?
    -If new date(28 days out) is a Saturday then subtract 1 day to display Friday date
    -If new date(28 days out) is a Sunday then add 1 day to display Monday date

    I would appreciate it if you are able to assist with this.

  6. #6
    Registered User
    Join Date
    06-07-2012
    Location
    hbg,pa
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Macro w shortcut key to paste date 28 days from today into active cell

    Forgot to change back to [UNSOLVED]

  7. #7
    Forum Contributor
    Join Date
    01-03-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: Macro w shortcut key to paste date 28 days from today into active cell

    Try something like this:

    Please Login or Register  to view this content.
    Hope you'll find it helpful

  8. #8
    Registered User
    Join Date
    06-07-2012
    Location
    hbg,pa
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Macro w shortcut key to paste date 28 days from today into active cell

    Hi Sbarro79

    Thank you for trying to help with this.

    I inputted the code into my macro and got a debugger error at the first "If Weekday" saying argument is not optional.

  9. #9
    Forum Contributor
    Join Date
    01-03-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: Macro w shortcut key to paste date 28 days from today into active cell

    Sorry to hear that it didn't work.
    I tested the code on my computer before posting and it worked so I don't know why this error occurred. Maybe it's just because of different Excel version (but it's rather unlikely).
    Meanwhile try to change this line:
    Please Login or Register  to view this content.
    to this:
    Please Login or Register  to view this content.
    and see if this works.

  10. #10
    Registered User
    Join Date
    06-07-2012
    Location
    hbg,pa
    MS-Off Ver
    Excel 2003
    Posts
    38

    Re: Macro w shortcut key to paste date 28 days from today into active cell

    Thanks Sbarro79!

    I went to make the change that you suggested and found an extra = sign in the code that I had earlier inputted, and lo and behold, your original suggestion worked just fine! I apologize for any inconvenience, and am thankful for your help!

  11. #11
    Forum Contributor
    Join Date
    01-03-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: Macro w shortcut key to paste date 28 days from today into active cell

    Oh well, mistakes just happens
    Good to know I was helpful.
    Please mark the thread as Solved if it's not a problem.

+ 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