Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Copy worksheet, trying to paste to new workbook error assistance.

I have a workbook that calls the following sub to copy the calculated sheet
and renames it based on the range within the cell.

The core code seems to work but every so often it hiccups and tries to copy
the 'summary' sheet to a new book rather than remain in the source file
'Buzz.xls'

Attached my code. Is theer any way of telling it that it must copy into the
buzz workbook?

Sub Copy_TeamFile()

Sheets("Summary").Select

'copy sheet
Sheets("Summary").Select
Sheets("Summary").Copy After:=Worksheets(Worksheets.Count)
Sheets("Summary (2)").Select

'Refresh data
Call Calc_Update

'paste values
Cells.Select
Range("A7").Activate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

'Rename sheet to team name
ActiveSheet.Name = Range("B2").Value

'Repeat for every team if neccesary
Sheets("Control").Select
Range("A1").Select

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Copy worksheet, trying to paste to new workbook error assistance.

Give this a try:

Sub Copy_TeamFile()

Set newSht = Sheets("Summary").Copy(After:=Worksheets(Worksheet s.Count))
'Refresh data
Call Calc_Update
'paste values
newSht.Cells.Copy
newSht.Cells.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False

'Rename sheet to team name
newSht.Name = Range("B2").Value

'Repeat for every team if neccesary
Sheets("Control").Select
Range("A1").Select

End Sub


I am not sure what Calc_Update does, so if there is a problem, you might
need to look at that macro also.



"fishy" wrote in message
...
I have a workbook that calls the following sub to copy the calculated sheet
and renames it based on the range within the cell.

The core code seems to work but every so often it hiccups and tries to
copy
the 'summary' sheet to a new book rather than remain in the source file
'Buzz.xls'

Attached my code. Is theer any way of telling it that it must copy into
the
buzz workbook?

Sub Copy_TeamFile()

Sheets("Summary").Select

'copy sheet
Sheets("Summary").Select
Sheets("Summary").Copy After:=Worksheets(Worksheets.Count)
Sheets("Summary (2)").Select

'Refresh data
Call Calc_Update

'paste values
Cells.Select
Range("A7").Activate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

'Rename sheet to team name
ActiveSheet.Name = Range("B2").Value

'Repeat for every team if neccesary
Sheets("Control").Select
Range("A1").Select

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
copy and paste whole worksheet from one workbook to another Allen the Computer Guy Excel Programming 3 December 29th 09 10:06 PM
Copy/Paste Worksheet to End of Workbook DBavirsha Excel Programming 3 August 15th 07 08:08 PM
Copy paste to another Workbook, Error 1004 Steve[_87_] Excel Programming 7 April 16th 07 05:49 PM
copy data from one worksheet and paste into another workbook Mike R. Excel Programming 1 December 21st 04 07:35 AM
Copy and paste the worksheet to New workbook.. Sudarshan[_3_] Excel Programming 1 May 26th 04 06:51 PM


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