Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Subscript out of range | Excel Discussion (Misc queries) | |||
Subscript out of Range | Excel Discussion (Misc queries) | |||
9: Subscript out of range | Excel Discussion (Misc queries) | |||
Subscript out of range | Excel Programming | |||
Subscript out of range | Excel Programming |