View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
PCLIVE PCLIVE is offline
external usenet poster
 
Posts: 168
Default Coping a Worksheet - but Getting an Error

It seems that you're missing the sheet of which the copy should be placed
after. However, that causes a different error. Make sure the fName is set
appropriately. After you get the error, hover your mouse pointer over fName
and see if it displays the correct file name. Also, make sure that file is
open.

Good Luck,
Paul

"Max" wrote in message
...
I'm trying to use the following code to select a worksheet from one opened
file to another(filename 'fName' is passed to the sub function):


FileList = Application _
.GetOpenFilename( _
FilterIndex:=1, _
Title:="Open File That Contains
Anderson
List")




Workbooks.Open Filename:=FileList
Sheets("Anderson List").Select
ActiveSheet.Copy After:=Workbooks(fName).Sheets
End Sub

But I'm getting a subscript out of range error. Any ideas why?

--
Thanks!
Max