View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Copying Worksheet to Another Open Workbook

I'd use the workbooks collection (instead of windows):

Workbooks("BaseFile.xls").workSheets("Temp").Copy _
After:=Workbooks(fStr).Sheets(1)

But what's in fStr?

If you don't include the .xls, start including it.
If you include the path, don't.

And is the workbook named fStr open?


" wrote:

I have a worksheet named "Temp" that resides in a Workbook called
"BaseFile.xls". I'm trying to copy it to another workbook whose name I
have stored in a string fStr.

Here's what I have:

Windows("BaseFile.xls").Activate
Sheets("Temp").Copy After:=Workbooks(fStr).Sheets(1)

But I'm getting a subscript out of range problem with fStr in
Workbooks....

Could someone tell me what the correct code should be.
Most appreciated.


--

Dave Peterson