0

Every day, I need to access new information with this constantly changing file. I have to export the sheet, and the name is usually like "RepairResults_6_23_20_15_45_07" which is the name of the content with the date and time attached to the end. I wanted to make this dummy-proof for future users, so they can just press a button, and it'll copy the info from the exported sheet and do the work for them. I've tried accessing the Documents path through the computer, but there are other excel files that start with "RepairResult" so I couldn't just use the beginning. This is what I currently have for the other sheet it pulls info from (and actually works):

    Windows("Plant Report.csv").Activate
    Cells.Select
    Selection.Copy
    Windows("HGL Sheet.xlsm").Activate
    Sheets("Data Dump").Select
    Range("A1").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False 

Any suggestions on how to apply this to an ever-changing workbook?

BigBen
  • 46,229
  • 7
  • 24
  • 40
  • 2
    You can use `Format` and `Date`: `Format(Date, "m_dd_yy")` will return `6_23_20`. Then use `Dir` and a wildcard `*` for the time portion of the file name. – BigBen Jun 26 '20 at 15:53
  • Aside: Please see [How to avoid using Select in Excel VBA](https://stackoverflow.com/q/10714251/1422451). – Parfait Jun 26 '20 at 17:36

0 Answers0