Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copying worksheet to new file by macro


Hi.
By pressing a commandbutton, I want to copy a worksheet (The content,
not the functions) into a new file.
There are 52 worksheets called "Vecka 1" to "Vecka 52".
The user enters a number in a cell and presses a command button next to
that cell, and then the worksheet with the number the user has given
should be copied to a file called "Vecka xx.xls" where xls is the
number of the worksheet." (Vecka 0-52).

How to do that?


--
Ruatha
------------------------------------------------------------------------
Ruatha's Profile: http://www.excelforum.com/member.php...o&userid=31083
View this thread: http://www.excelforum.com/showthread...hreadid=550773

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copying worksheet to new file by macro

Hi Ruatha

Sub test()
Dim wb As Workbook
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb.Sheets(1)
.UsedRange.Copy
.UsedRange.PasteSpecial xlPasteValues
.Cells(1).Select
Application.CutCopyMode = False
End With
wb.SaveAs "C:\" & wb.Sheets(1).Name & ".xls"
wb.Close False
End Sub


This example will create a workbook for every sheet
http://www.rondebruin.nl/copy6.htm


--
Regards Ron De Bruin
http://www.rondebruin.nl



"Ruatha" wrote in message
...

Hi.
By pressing a commandbutton, I want to copy a worksheet (The content,
not the functions) into a new file.
There are 52 worksheets called "Vecka 1" to "Vecka 52".
The user enters a number in a cell and presses a command button next to
that cell, and then the worksheet with the number the user has given
should be copied to a file called "Vecka xx.xls" where xls is the
number of the worksheet." (Vecka 0-52).

How to do that?


--
Ruatha
------------------------------------------------------------------------
Ruatha's Profile: http://www.excelforum.com/member.php...o&userid=31083
View this thread: http://www.excelforum.com/showthread...hreadid=550773



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copying worksheet to new file by macro


Thanx.
It works good and makes a file for the active worksheet, now I'll try
to adapt it to my needs!

Thanx again Ron de Bruin


--
Ruatha
------------------------------------------------------------------------
Ruatha's Profile: http://www.excelforum.com/member.php...o&userid=31083
View this thread: http://www.excelforum.com/showthread...hreadid=550773

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
Copying worksheet with macro Janelle S[_2_] Excel Discussion (Misc queries) 2 November 2nd 08 10:38 PM
macro for copying file Joseph Excel Discussion (Misc queries) 1 August 24th 05 02:07 PM
Copying a worksheet from a different file into existing (VB-6/VBA/ Mike Excel Programming 3 May 16th 05 11:02 PM
Copying text file into worksheet No Name Excel Programming 1 October 11th 04 04:56 AM
Copying Data into another worksheet using macro Andy W Excel Programming 1 February 19th 04 04:01 PM


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