Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro can copy a spreadsheet in a workbook. I start of with two
spreadsheets in the workbook. The second sheet is the one I copy. On the first worksheet I have the number of times the second spreadsheet is to be copied in a cell, say C2. Below I have the name of each of the worksheets. What I want to do is to copy the second worksheet N times where N is the number in the cell C2 of the first worksheet - ie. I want to automatically run my macro to copy a spreadsheet N times. I then want to run a macro for renaming those worksheet according to names listed in the firsr worksheet. How do I accomplish this? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you.
Adrian "Mike Fogleman" wrote: This will do that: Sub CopyNsheets() Dim i As Long For i = 1 To Worksheets("Sheet1").Range("C2").Value Sheets("Sheet2").Copy After:=Worksheets(Sheets.Count) ActiveSheet.Name = Worksheets("Sheet1").Range("C2").Offset(i, 0).Value Next End Sub Mike F "Adrian Watts" <Adrian wrote in message ... I have a macro can copy a spreadsheet in a workbook. I start of with two spreadsheets in the workbook. The second sheet is the one I copy. On the first worksheet I have the number of times the second spreadsheet is to be copied in a cell, say C2. Below I have the name of each of the worksheets. What I want to do is to copy the second worksheet N times where N is the number in the cell C2 of the first worksheet - ie. I want to automatically run my macro to copy a spreadsheet N times. I then want to run a macro for renaming those worksheet according to names listed in the firsr worksheet. How do I accomplish this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating new worksheets | Excel Worksheet Functions | |||
Creating old xls worksheets. | Excel Discussion (Misc queries) | |||
VBA / Macro for creating new worksheets and new columns from existing worksheets | Excel Programming | |||
Sort Numerically Worksheets via VB when creating a new worksheets | Excel Programming | |||
Creating worksheets then name it | Excel Programming |