Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Tom-
Thanks for the reply. This code errors on the set bk line. It is giving me a run-time error 1004. Just to be clear....the file that is being pasted into is already open at the point this code is run. Not sure what the (sName) code is above as well... Thanks, Chris |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That is the point Chris. You say you are processing 100 files, so it
doesn't open itself. When you open it, set a reference to it and use that reference. for example, if you were opening all the files in a single directory Dim bk as Workbook Dim sName as String sName = Dir("C:\Myfolder\*.xls") do while sName < "" set bk = Workbooks.Open("C:\MyFolder\" & sName) Workbooks("Macro1.xls").Worksheets("Sheet5").Range ("1:2").copy bk.Worksheets(1).Rows(3).Insert Shift:=xldown loop Adapt if you are working through a list of names. -- Regards, Tom Ogilvy wrote in message ps.com... Hi Tom- Thanks for the reply. This code errors on the set bk line. It is giving me a run-time error 1004. Just to be clear....the file that is being pasted into is already open at the point this code is run. Not sure what the (sName) code is above as well... Thanks, Chris |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom-
Thanks for the help. Everything is running properly. I appreciate the explanation and the help. Take Care, Chris |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do I toggle between 2 open excel files and leave both open | Excel Discussion (Misc queries) | |||
How to change default Open/Files of Type to "Microsoft Excel Files | Excel Discussion (Misc queries) | |||
Macro to open *.dat files and save as .txt (comma delimited text files) | Excel Programming | |||
Open multiple text files and paste contents to single cell | Excel Programming | |||
file open via IE hyperlink causes already open files to shrink and tile | Setting up and Configuration of Excel |