LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Subscript out of range

Can you please help? :)

I've created following macro

------------------------------------------------
Public Function TEST()
Dim XLSApp As Excel.Application
Dim XLSBook1, XLSBook2 As Workbook

Set XLSBook1 = ActiveWorkbook

Set XLSApp = New Excel.Application
XLSApp.Visible = True
Set XLSBook2 = XLSApp.Workbooks.Add

XLSBook2.SaveAs "C:\TEST_1.xls"

XLSApp.Quit

XLSBook1.Worksheets("Sheet1").Copy _
after:=Workbooks("C:\TEST_1.xls").Worksheets("Shee t1")

End Function
------------------------------------------------

In general I wanted to copy Sheet1 form ActiveWorkbook to the Workbook
created and saved under "C:\TEST_1.xls" by this macro.
The only and biggest problem I get is with the

XLSBook1.Worksheets("Sheet1").Copy _
after:=Workbooks("C:\TEST_1.xls").Worksheets("Shee t1")

It always returns "Run Time Error '9' Subscript out of range".
What might be the reason for it?

TIA
 
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
Subscript out of range OKHM Excel Discussion (Misc queries) 0 August 6th 09 05:18 PM
Subscript out of Range Steve Excel Discussion (Misc queries) 3 April 15th 09 04:01 PM
9: Subscript out of range jenz21985 Excel Discussion (Misc queries) 6 May 5th 06 03:36 PM
Subscript out of range teresa Excel Programming 1 December 14th 04 09:56 PM
Subscript out of range Bill Murphy Excel Programming 1 August 5th 04 08:52 AM


All times are GMT +1. The time now is 03:17 PM.

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

About Us

"It's about Microsoft Excel"