Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Export worksheet in New File by VBA code


Hi,

I arranged one worksheet (Data), there are lot of formulas and it is
linked to other sheets. I need button to prepare a copy of (Data)
sheet to new file, without formula I mean special past - only Values.
Actually my (Data) sheet is Fit to one page as 100% view.

I need code to copy the Data sheet to new file asking location to save
this file with full formatting and actual margens.

Pls help me.


Shahzad
Madinah

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Export worksheet in New File by VBA code

Sub CopyDataSheet()
Dim mySht As Worksheet

Sheets("Data").Copy Befo=Sheets(1)
With ActiveSheet
..Name = "Data Copy"
With .Cells
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
..Move
End With
ActiveWorkbook.SaveAs Application.GetSaveAsFilename _
("New data file.xls", , , "Enter a new file name")
End Sub

HTH,
Bernie
MS Excel MVP


wrote in message
ups.com...

Hi,

I arranged one worksheet (Data), there are lot of formulas and it is
linked to other sheets. I need button to prepare a copy of (Data)
sheet to new file, without formula I mean special past - only Values.
Actually my (Data) sheet is Fit to one page as 100% view.

I need code to copy the Data sheet to new file asking location to save
this file with full formatting and actual margens.

Pls help me.


Shahzad
Madinah



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Export worksheet in New File by VBA code

On Jul 3, 3:06 pm, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Sub CopyDataSheet()
Dim mySht As Worksheet

Sheets("Data").Copy Befo=Sheets(1)
With ActiveSheet
.Name = "Data Copy"
With .Cells
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
.Move
End With
ActiveWorkbook.SaveAs Application.GetSaveAsFilename _
("New data file.xls", , , "Enter a new file name")
End Sub

HTH,
Bernie
MS Excel MVP

wrote in message

ups.com...





Hi,


I arranged one worksheet (Data), there are lot of formulas and it is
linked to other sheets. I need button to prepare a copy of (Data)
sheet to new file, without formula I mean special past - only Values.
Actually my (Data) sheet is Fit to one page as 100% view.


I need code to copy the Data sheet to new file asking location to save
this file with full formatting and actual margens.


Pls help me.


Shahzad
Madinah- Hide quoted text -


- Show quoted text -



Dear Bernie,

Thank you very much for sending me the above solution, I test it and
it is working great. there is only one small problem I seen. Actually
I have some Buttons on the Data sheet, when I run your code, all the
buttons are also copied in to new file. and I dont need any button in
new file.

I made all the buttons from "FORM tool menu". now what to do, copy
Data sheet in new file without buttons.

Thanks in advance.

Regards.

Shahzad




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Export worksheet in New File by VBA code

Sub CopyDataSheet2()
Dim mySht As Worksheet

Sheets("Data").Copy Befo=Sheets(1)
With ActiveSheet
.Shapes.SelectAll
Selection.Delete

.... Rest of code

HTH,
Bernie
MS Excel MVP


wrote in message
oups.com...
On Jul 3, 3:06 pm, "Bernie Deitrick" <deitbe @ consumer dot org
wrote:
Sub CopyDataSheet()
Dim mySht As Worksheet

Sheets("Data").Copy Befo=Sheets(1)
With ActiveSheet
.Name = "Data Copy"
With .Cells
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
.Move
End With
ActiveWorkbook.SaveAs Application.GetSaveAsFilename _
("New data file.xls", , , "Enter a new file name")
End Sub

HTH,
Bernie
MS Excel MVP

wrote in message

ups.com...





Hi,


I arranged one worksheet (Data), there are lot of formulas and it is
linked to other sheets. I need button to prepare a copy of (Data)
sheet to new file, without formula I mean special past - only Values.
Actually my (Data) sheet is Fit to one page as 100% view.


I need code to copy the Data sheet to new file asking location to save
this file with full formatting and actual margens.


Pls help me.


Shahzad
Madinah- Hide quoted text -


- Show quoted text -



Dear Bernie,

Thank you very much for sending me the above solution, I test it and
it is working great. there is only one small problem I seen. Actually
I have some Buttons on the Data sheet, when I run your code, all the
buttons are also copied in to new file. and I dont need any button in
new file.

I made all the buttons from "FORM tool menu". now what to do, copy
Data sheet in new file without buttons.

Thanks in advance.

Regards.

Shahzad






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
Simple Export of worksheet contents to text-file. haakon Excel Programming 0 January 22nd 07 12:55 PM
how do I export a worksheet as a fixed format ascii file SVANATTA65 Excel Discussion (Misc queries) 2 June 16th 05 11:49 PM
Macro to export a worksheet and save as new file Mike_M Excel Programming 2 May 25th 05 10:37 AM
Import VBA Code in Excel-File ? (Export VBA Code to file) Matthias Pospiech Excel Programming 2 March 22nd 05 04:56 PM
Request Vba code Export gif file Luigi[_2_] Excel Programming 3 February 17th 04 12:52 PM


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