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: 24
Default Combining several workbooks into one workbook

While trying to run this macro, I get this error. Any insights?

Thanks
---------------------------
Microsoft Excel
---------------------------
Method 'Move' of object 'Sheets' failed
---------------------------
OK
---------------------------

Here is the Syntax

Sub CombineWorkbooks()
Dim FilesToOpen
Dim x As Integer

On Error GoTo ErrHandler
Application.ScreenUpdating = False

FilesToOpen = Application.GetOpenFilename _
(FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
MultiSelect:=True, Title:="Files to Merge")

If TypeName(FilesToOpen) = "Boolean" Then
MsgBox "No Files were selected"
GoTo ExitHandler
End If

x = 1
While x <= UBound(FilesToOpen)
Workbooks.Open FileName:=FilesToOpen(x)
Sheets().Move After:=ThisWorkbook.Sheets _
(ThisWorkbook.Sheets.Count)
x = x + 1
Wend

ExitHandler:
Application.ScreenUpdating = True
Exit Sub

ErrHandler:
MsgBox Err.Description
Resume ExitHandler
End Sub

 
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
Combining two workbooks WLMPilot Excel Discussion (Misc queries) 0 December 13th 07 07:25 PM
Combining Workbooks RonnieF Charts and Charting in Excel 0 May 17th 07 08:40 PM
Combining several workbooks into one workbook Betty Excel Programming 2 March 28th 07 12:22 AM
combining workbooks Fawn Excel Worksheet Functions 0 April 13th 05 03:24 AM
Combining workbooks into one????? ian123[_7_] Excel Programming 18 December 17th 03 06:00 PM


All times are GMT +1. The time now is 07:13 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"