rubyinfusive
New Member
- Joined
- Jun 12, 2015
- Messages
- 3
Using Excel 2007
I receive a daily data dump in a specific file directory that has a time stamp in the form of "Name yyyy_MM_dd_hhmmss.csv"
Because the timestamp is not consistent, I am struggling to create a macro that can pickup the correct file from the folder.
Is there a macro that i can create that will rename "Name yyyy_MM_dd_hhmmss" to "Name yyyyMMdd"
In fact, if VBA can understand the format "Name yyyy_MM_dd" I'd be happy to just have "_hhmmss" deleted.
Alternatively, if there is a way to create a macro that can just look for "Name yyyy_MM_dd" and ignore that the timestamp, that would also be fine.
Currently I am using VBA to reference a date in my workbook in order to import the correct csv and I just need to find a way to do that for a file that contains a file name with a constantly changing timestamp.
e.g. Workbooks.Open FileName:= _
"\\Name " & Format(Sheets("test").Range("K3").Value, "yyyymmdd") & ".csv"
Many thanks!
I receive a daily data dump in a specific file directory that has a time stamp in the form of "Name yyyy_MM_dd_hhmmss.csv"
Because the timestamp is not consistent, I am struggling to create a macro that can pickup the correct file from the folder.
Is there a macro that i can create that will rename "Name yyyy_MM_dd_hhmmss" to "Name yyyyMMdd"
In fact, if VBA can understand the format "Name yyyy_MM_dd" I'd be happy to just have "_hhmmss" deleted.
Alternatively, if there is a way to create a macro that can just look for "Name yyyy_MM_dd" and ignore that the timestamp, that would also be fine.
Currently I am using VBA to reference a date in my workbook in order to import the correct csv and I just need to find a way to do that for a file that contains a file name with a constantly changing timestamp.
e.g. Workbooks.Open FileName:= _
"\\Name " & Format(Sheets("test").Range("K3").Value, "yyyymmdd") & ".csv"
Many thanks!