+ Reply to Thread
Results 1 to 9 of 9

Change date on file from pop up each time I run macro

  1. #1
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Lightbulb Change date on file from pop up each time I run macro

    Hi,

    So i'm running a macro which opens a file. I will be running this macro everyday and the date of the file changes everyday.

    This is my current code:

    Please Login or Register  to view this content.
    Please note "SM Daily Report 23102013" is the workbook that is currently open and where the macros are stored.

    Everywhere in the macro that says "23102013" I need to somehow have an option to change that everytime I run the macro, or have an option to select a date. Tomorrow all the files will be names 24102013.

    Any thoughts on this?

    Thanks

  2. #2
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: Change date on file from pop up each time I run macro

    I'm guessing is it possible to simply find and replace a macro?

    Either that or somehow use a reference to TODAY() as it will only be used on today's data.

    Cheers

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change date on file from pop up each time I run macro

    try
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: Change date on file from pop up each time I run macro

    Ok.. where do I put that? In a new macro it'self?

    I'm creating this for my peers who don't know how to use VB. So to make it customer friendly ideally I need to have something on an excel worksheet where you either click a button and enter the date, or type the date into a cell and the macro populates from that cell.

    Make sense?

    Cheers

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change date on file from pop up each time I run macro

    Hi jonathan

    This is what I had in mind...no button required
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: Change date on file from pop up each time I run macro

    Ahh this works brilliantly, thanks!

    I'm doing this with several files and one of the dates is the day before today, so is there a way of doing the same as above but saying YESTERDAY rather than TODAY? (for the workbook only).

    Cheers!

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change date on file from pop up each time I run macro

    Hi jonathan

    Try this
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    09-03-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    132

    Re: Change date on file from pop up each time I run macro

    Great, thanks! Great help

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Change date on file from pop up each time I run macro

    You're welcome...glad I could help. Thanks for the Rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro: Help, Need Macro, Change Color, Open File, Restart at date
    By fastfire in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2013, 05:52 PM
  2. How Change the Date \ Time Stamp of a file to a number ? (EXCEL VBA)
    By nawaralobaidi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-06-2012, 12:23 PM
  3. Replies: 0
    Last Post: 05-18-2012, 04:42 AM
  4. Macro to backup file with date and time
    By Nigel in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-04-2009, 09:53 AM
  5. Macro to save Excel file with date and time in the file name?
    By sonic_d_hog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2006, 02:00 PM

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