Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copying Sheet - subscript out of range error

I tried to use this command
Sheets("Report").Copy Befo=Workbooks(xl_file).Sheets(1)
where xl_file is an object containing the full path to the file I want to
copy the sheet into.

When I ran this I got 'data type mismatch' so I defined xl_file_fmt as a
string which made this statement;

Sheets("Report").Copy Befo=Workbooks(xl_file_fmt).Sheets(1)

Now I'm getting a 'subscrit out of range' error.....

ARGHH.... don't know if I'll ever get this stuff.

I'm sure someone out there can tell me the problem that I'm obviously
overlooking

tia
Steve


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Copying Sheet - subscript out of range error

workbooks(xxxx)
expects just the name--no drive, no path.

like:

dim xl_file as string
xl_file = "book1.xls"
Sheets("Report").Copy Befo=Workbooks(xl_file).Sheets(1)

And that receiving file has to be open.

"GSP@DCS" wrote:

I tried to use this command
Sheets("Report").Copy Befo=Workbooks(xl_file).Sheets(1)
where xl_file is an object containing the full path to the file I want to
copy the sheet into.

When I ran this I got 'data type mismatch' so I defined xl_file_fmt as a
string which made this statement;

Sheets("Report").Copy Befo=Workbooks(xl_file_fmt).Sheets(1)

Now I'm getting a 'subscrit out of range' error.....

ARGHH.... don't know if I'll ever get this stuff.

I'm sure someone out there can tell me the problem that I'm obviously
overlooking

tia
Steve


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime Error - Subscript out of range despite On Error statement DoctorG Excel Programming 3 July 28th 06 03:56 PM
Subscript out of range error - save copy error bg18461[_16_] Excel Programming 2 June 13th 06 04:53 PM
Subscript out of range error - save copy error bg18461[_15_] Excel Programming 1 June 13th 06 04:36 PM
In multiple sheet copy error subscript out of range ?? HELP Eddy Stan Excel Programming 4 March 22nd 06 04:54 AM
Type Mismatch error & subscript out of range error Jeff Wright[_2_] Excel Programming 3 May 14th 05 07:14 PM


All times are GMT +1. The time now is 02:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"