+ Reply to Thread
Results 1 to 2 of 2

How to get macro to open file name based on today's date?

  1. #1
    Registered User
    Join Date
    07-05-2013
    Location
    Asia
    MS-Off Ver
    Excel 2007
    Posts
    1

    Unhappy How to get macro to open file name based on today's date?

    Dear friends,

    I have a macro which is like this now:

    Sub CopyMacronew()
    '
    ' CopyMacronew Macro
    '
    '
    Workbooks.Open Filename:= _
    "L:\DIR\Daily Report\2013\07. Jul 2013\" & Range("B1") & ".xls", UpdateLinks:=0
    Application.DisplayAlerts = False
    Application.Calculation = xlManual
    ActiveWindow.Close
    Workbooks.Open Filename:= _
    "L:\DIR\Daily Report\2013\07. Jul 2013\" & Range("B1") & ".xls", UpdateLinks:=0
    Cells.Select
    '
    Selection.Copy


    After copying, How to I get it to open up a file in a folder which is titled today's date and changes everyday so that I can paste it to this new file everyday?

    Thank you!

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: How to get macro to open file name based on today's date?

    Hi, ytc1,

    I would use objects for the workbooks, and there is no use in copying the contents of the whole sheet (ActiveSheet.UsedRange should be good enough):

    Please Login or Register  to view this content.
    Remember: any newly opened workbook will be the active one in Excel.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ 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