automationamateur
Board Regular
- Joined
- Jan 3, 2011
- Messages
- 166
VBA newbie and first post, so apologies ahead of time. I have 4 weekly .xls files emailed to me (which i save to C:\Documents and Settings\adam.r.mcreynolds\My Documents\Roger\COPS\new weekly files\). These files are deleted every week and 4 new files are added when received (4 files for 4 different regions, 'east', 'cent', 'flor', 'west'). The files names change week to week, for example one week they will be 'open bob east 12-27' the next week they will be 'open bob east 01-03' etc.
I am attempting to write a macro that copies the data from each file and pastes it into a corresponding master worksheet (this master worksheet also changes name every week). I can do this simple enough with a static file name but not with a changing name. I have read the other posts on this same topic and tried for hours to no avail. Below is what I have for a static file name solution (I don't need assistance on the copy/paste portion just getting the files open) How can I get the same results as below but with a wildcard (ie Workbooks.Open "C:\Documents and Settings\adam.r.mcreynolds\My Documents\Roger\COPS\new weekly files\open bob east*")
Workbooks.Open "C:\Documents and Settings\adam.r.mcreynolds\My Documents\Roger\COPS\new weekly files\open bob east 12-27"
Workbooks.Open "C:\Documents and Settings\adam.r.mcreynolds\My Documents\Roger\COPS\new weekly files\open bob cent 12-27"
Workbooks.Open "C:\Documents and Settings\adam.r.mcreynolds\My Documents\Roger\COPS\new weekly files\open bob flor 12-27"
Workbooks.Open "C:\Documents and Settings\adam.r.mcreynolds\My Documents\Roger\COPS\new weekly files\open bob west 12-27"
THANKS AHEAD OF TIME!!!
I am attempting to write a macro that copies the data from each file and pastes it into a corresponding master worksheet (this master worksheet also changes name every week). I can do this simple enough with a static file name but not with a changing name. I have read the other posts on this same topic and tried for hours to no avail. Below is what I have for a static file name solution (I don't need assistance on the copy/paste portion just getting the files open) How can I get the same results as below but with a wildcard (ie Workbooks.Open "C:\Documents and Settings\adam.r.mcreynolds\My Documents\Roger\COPS\new weekly files\open bob east*")
Workbooks.Open "C:\Documents and Settings\adam.r.mcreynolds\My Documents\Roger\COPS\new weekly files\open bob east 12-27"
Workbooks.Open "C:\Documents and Settings\adam.r.mcreynolds\My Documents\Roger\COPS\new weekly files\open bob cent 12-27"
Workbooks.Open "C:\Documents and Settings\adam.r.mcreynolds\My Documents\Roger\COPS\new weekly files\open bob flor 12-27"
Workbooks.Open "C:\Documents and Settings\adam.r.mcreynolds\My Documents\Roger\COPS\new weekly files\open bob west 12-27"
THANKS AHEAD OF TIME!!!