![]() |
Copy cells from a excel file that filename changes daily.
I have a file titled FP Skill by 15 min_12345678.XLS. Howeve each day
the _12345678 part of the file name changes. I wuold like to open that file and copy some cells out of it with a macro. The one below works fine if I have the excat name of the file in it, but I would like it to just open any file LIKE FP Skill by 15 min_*.XLS. The astrick does not work for me. Sub GetFPSkillby15() Workbooks.Open Filename:= _ "FP Skill by 15 min_*.XLS" Rows("1:65").Select Selection.Copy Windows("David of Chart Daily-FP 08-10-06.xls").Activate Range("A26").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True Sheets("Data Input").Select End Sub Any ideas. Both files are located in the same folder. David |
Copy cells from a excel file that filename changes daily.
Sub GetFPSkillby15()
sname = Dir("FP Skill by 15 Min_*.xls") Workbooks.Open Filename:= _ sName Rows("1:65").Select Selection.Copy Windows("David of Chart Daily-FP 08-10-06.xls").Activate Range("A26").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True Sheets("Data Input").Select End Sub -- Regards, Tom Ogilvy "gumby" wrote: I have a file titled FP Skill by 15 min_12345678.XLS. Howeve each day the _12345678 part of the file name changes. I wuold like to open that file and copy some cells out of it with a macro. The one below works fine if I have the excat name of the file in it, but I would like it to just open any file LIKE FP Skill by 15 min_*.XLS. The astrick does not work for me. Sub GetFPSkillby15() Workbooks.Open Filename:= _ "FP Skill by 15 min_*.XLS" Rows("1:65").Select Selection.Copy Windows("David of Chart Daily-FP 08-10-06.xls").Activate Range("A26").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True Sheets("Data Input").Select End Sub Any ideas. Both files are located in the same folder. David |
Copy cells from a excel file that filename changes daily.
Thank you -
Tom Ogilvy wrote: Sub GetFPSkillby15() sname = Dir("FP Skill by 15 Min_*.xls") Workbooks.Open Filename:= _ sName Rows("1:65").Select Selection.Copy Windows("David of Chart Daily-FP 08-10-06.xls").Activate Range("A26").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True Sheets("Data Input").Select End Sub -- Regards, Tom Ogilvy "gumby" wrote: I have a file titled FP Skill by 15 min_12345678.XLS. Howeve each day the _12345678 part of the file name changes. I wuold like to open that file and copy some cells out of it with a macro. The one below works fine if I have the excat name of the file in it, but I would like it to just open any file LIKE FP Skill by 15 min_*.XLS. The astrick does not work for me. Sub GetFPSkillby15() Workbooks.Open Filename:= _ "FP Skill by 15 min_*.XLS" Rows("1:65").Select Selection.Copy Windows("David of Chart Daily-FP 08-10-06.xls").Activate Range("A26").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True Sheets("Data Input").Select End Sub Any ideas. Both files are located in the same folder. David |
All times are GMT +1. The time now is 05:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com