LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Create New WB with copy of Sheets 1 & 2 when sheets count reaches 100

What i want to do is create a New workBook, when the number of worksheets reaches 100.
I have a button set up to create a new record(sheet) from a Template (Sheet1) in a workbook.
To save over sizing and increasing the chances of a file crash, i want to have the WB, if the create a New Record Buton is clicked and there is already 99 Records(sheets) in the file, The make a Copy of the first 2 sheets(Opening Page & Template) and CREATE a NEW WORKBOOK with these in them.

Currently i have this:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 25/06/2006 by Corey
'
Set wb = Workbooks.Add
ThisWorkbook.Sheets("Template").Copy Befo=wb.Sheets(1)
For i = wb.Sheets.Count To 2 Step -1
wb.Sheets(i).Delete
Next i
wb.Sheets(1).Name = "Template"

'
End Sub


It will copy 1 Sheet only, But i need to adapt this to copy the first 2 sheets, AND to do so ONLY when the Number of SHEETS totals say 99.



Any idea's, is it possible?

Corey....







 
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
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
Create new workbook, temporarily name it and copy sheets to it DerbyJim Excel Programming 4 January 12th 06 05:03 PM
create workbook, copy sheets Pierre via OfficeKB.com[_2_] Excel Programming 0 October 25th 05 07:51 AM
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? Daniel Excel Worksheet Functions 1 July 6th 05 09:57 PM
Create New Workbook - Name book - 4 Sheets - Name Sheets Greg[_21_] Excel Programming 6 June 12th 05 04:41 AM


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