singapore99
New Member
- Joined
- Sep 24, 2014
- Messages
- 3
Hey All, I am trying to copy data from one workbook into another. The data that is being copied is in an excel file that exported from a website that has a changing file name (something that I do not have control over). The front half of the file name remains the same, but it is the back half, where it has the date is located, changes the date to whenever I export the file. I have the code where I can copy the data from the one workbook to the other with no problem. However, my issue is that for every day I export the data, I would need to update the code with the new file name. Any thoughts on how I can create a code that would allow for a fluctuation in the file name. I have pasted my basic code that I am using and underlined the issue that I am having. Any advice or help would be greatly appreciated.
Sub Workbook_Copy_All()
'
' Workbook_Copy_All Macro
'
'
Windows("Suicide Prevention Users- 10-7-2014 (1).xls"). _
Activate
Range("A1:K100").Select
Range("G1").Activate
Cells.Select
Range("G1").Activate
Selection.Copy
Windows("Tracker Test Coding.xlsm").Activate
ActiveSheet.Paste
Range("A1:A3").Select
End Sub
Sub Workbook_Copy_All()
'
' Workbook_Copy_All Macro
'
'
Windows("Suicide Prevention Users- 10-7-2014 (1).xls"). _
Activate
Range("A1:K100").Select
Range("G1").Activate
Cells.Select
Range("G1").Activate
Selection.Copy
Windows("Tracker Test Coding.xlsm").Activate
ActiveSheet.Paste
Range("A1:A3").Select
End Sub