PC Review


Reply
Thread Tools Rate Thread

Copy worksheet, trying to paste to new workbook error assistance.

 
 
fishy
Guest
Posts: n/a
 
      6th May 2010
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 With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      6th May 2010
Give this a try:

Sub Copy_TeamFile()

Set newSht = Sheets("Summary").Copy(After:=Worksheets(Worksheets.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" <(E-Mail Removed)> wrote in message
news0700967-766F-4301-AC3E-(E-Mail Removed)...
>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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy and paste whole worksheet from one workbook to another Allen the Computer Guy Microsoft Excel Programming 3 29th Dec 2009 10:06 PM
Copy/Paste Worksheet to End of Workbook =?Utf-8?B?REJhdmlyc2hh?= Microsoft Excel Programming 3 15th Aug 2007 08:08 PM
copy data from one worksheet and paste into another workbook =?Utf-8?B?TWlrZSBSLg==?= Microsoft Excel Programming 1 21st Dec 2004 07:35 AM
Copy worksheet and paste it in New workbook, all data except Formulas Sudarshan Microsoft Excel Programming 4 26th May 2004 06:51 PM
Copy and paste the worksheet to New workbook.. Sudarshan Microsoft Excel Programming 1 26th May 2004 06:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:07 PM.