Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Moving sheets to another file

I'm trying to move certain sheets to a selected file and getting a "..out of
range" error.
Help?

Sub SendData()

Dim wb As String
wb = ThisWorkbook.Activate

Dim SendDataFname As String

SendDataFname = Application.SendOpenFilename("Excel files (*.xls),
*.xls")

Workbooks.Open SendDataFname

Sheets(Array("sheet2", "sheet3", "sheet4")).Move _
After:=Workbooks(wb).Sheets("sheet1")
Windows(SendDataFname).Activate
ActiveWorkbook.Save
ActiveWindow.Close

ThisWorkbook.Activate

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Moving sheets to another file

Tim,

Change
wb = ThisWorkbook.Activate
To
wb = ThisWorkbook.Name


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"TimT" wrote in message
...
I'm trying to move certain sheets to a selected file and
getting a "..out of
range" error.
Help?

Sub SendData()

Dim wb As String
wb = ThisWorkbook.Activate

Dim SendDataFname As String

SendDataFname = Application.SendOpenFilename("Excel
files (*.xls),
*.xls")

Workbooks.Open SendDataFname

Sheets(Array("sheet2", "sheet3", "sheet4")).Move _
After:=Workbooks(wb).Sheets("sheet1")
Windows(SendDataFname).Activate
ActiveWorkbook.Save
ActiveWindow.Close

ThisWorkbook.Activate

End Sub



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
Moving Data between sheets in the same workbook and moving data between Workbooks. Alison Brown Excel Worksheet Functions 0 February 10th 09 01:03 AM
Moving sheets Greg[_25_] Excel Programming 2 March 23rd 06 08:28 AM
Moving through sheets izlopez Excel Discussion (Misc queries) 1 January 13th 05 08:33 PM
Moving through sheets Keith Emery Excel Programming 2 June 22nd 04 01:53 PM
moving between sheets aschneid Excel Programming 2 May 11th 04 10:07 AM


All times are GMT +1. The time now is 05:54 PM.

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"