Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 90218

Copy and paste an excel file with variable name

$
0
0

What I want to design is a file which can copy and paste a file in the active worksheet. However, this file will be updated daily and also change its name. Therefore, I'd like to refer to a dynamic name so to say.

Sub stackoverflow()

' copy workbook to new worksheet

    Workbooks.Open Filename:= _
    "/Documents/Documenten/movementreport202001075.xlsx"
    Cells.Select
    Selection.Copy
    Windows("test").Activate
    ActiveSheet.Paste

End Sub

For instance, the "20200107" can be "20200108.xlsx" tomorrow. So it is dependent on the date, time and seconds you download the report.


Viewing all articles
Browse latest Browse all 90218

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>