Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Creating a new workbook/worksheet problems

Hi,
I have a workbook that has a worksheet ("Standings") containing formulas
such as ='old stuff'!a1
where 'old stuff' is another worksheet. what i want to do is copy it but
instead of references, want to save the values such that if 'old stuff'!a1 is
2000, the new worksheet (Standings again) has that value not the formula.
What I currently have is

Sheets("Standings").Select
Sheets("Standings").Copy
ActiveWorkbook.SaveAs Filename:=standings

but this still creates "Standings" in the new workbook with references.
other than looping thru all the cells with
cells(x,y).value = cells(x,y).value
is there another way? pastespecial with xlpastevalues is basically what I
want to do.

another part to this.

if the new workbook already exists when i do the SaveAs, I do get prompted
if I want to overwrite it. If I say NO, I get a 1004 error. I guess I could
use On Error to trap it, determine that it is the 1004 and just exit. Is
there a better way?


--
Randy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Creating a new workbook/worksheet problems

Sheets("Standings").Select
Sheets("Standings").Copy
Activesheet.Cells.copy
Activesheet.Cells.PasteSpecial xlValues
ans = vbYes
if dir("Standings.xls") < "" then
ans = msgbox("Standings Exists, do you want to overwrite it?", _
vbyesno)
end if
if ans = vbYes then
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="standings.xls"
Application.DisplayAlerts = True
End if

--
Regards,
Tom Ogilvy

"Randy" wrote in message
...
Hi,
I have a workbook that has a worksheet ("Standings") containing formulas
such as ='old stuff'!a1
where 'old stuff' is another worksheet. what i want to do is copy it but
instead of references, want to save the values such that if 'old stuff'!a1

is
2000, the new worksheet (Standings again) has that value not the formula.
What I currently have is

Sheets("Standings").Select
Sheets("Standings").Copy
ActiveWorkbook.SaveAs Filename:=standings

but this still creates "Standings" in the new workbook with references.
other than looping thru all the cells with
cells(x,y).value = cells(x,y).value
is there another way? pastespecial with xlpastevalues is basically what I
want to do.

another part to this.

if the new workbook already exists when i do the SaveAs, I do get prompted
if I want to overwrite it. If I say NO, I get a 1004 error. I guess I

could
use On Error to trap it, determine that it is the 1004 and just exit. Is
there a better way?


--
Randy



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 worksheet containing names to other workbook w/o problems? amsbam1 Excel Discussion (Misc queries) 1 December 3rd 08 04:23 PM
Creating Reports in another worksheet in a workbook Somewhere In Excel 2002 Excel Discussion (Misc queries) 3 August 23rd 07 09:54 PM
CREATING NEW WORKBOOK FILE EVERY MONTH AND NEW WORKSHEET EVERY DATE michael sofianos Excel Programming 1 May 9th 05 10:46 PM
Problems with Shared worksheet/workbook carvil16[_4_] Excel Programming 0 January 29th 04 02:20 PM
creating new workbook from single worksheet Shaun[_3_] Excel Programming 3 January 3rd 04 02:29 AM


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