Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copying worksheet with macro | Excel Discussion (Misc queries) | |||
macro for copying file | Excel Discussion (Misc queries) | |||
Copying a worksheet from a different file into existing (VB-6/VBA/ | Excel Programming | |||
Copying text file into worksheet | Excel Programming | |||
Copying Data into another worksheet using macro | Excel Programming |