Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default Code to Create a new WorkSheet


Is there code to create a new WorkSheet in a WorkBook and have it a
duplicate of another WorkSheet ?
Is there a limit to how many WorkSheets can be in a WorkBook ? Over time
there may be 10,000 sheets needed.

I have a costing sheet that i want to set up, but want to be able to search
through all records to find specific values in a costing sheet.
Is there a formula to search through ALL WorkSheets in the selected cell for
values that match, and to ONLY display those WorkSheets ?
I want to place a Button on the 1st WorkSheet and IF clicked, it creates a
New WorkSheet COPY of the Costing Sheet template.

How would i go about this?


Corey....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code to Create a new WorkSheet

It is limited by memory.

Putting 10000 sheets in a workbook would not be very smart in my opinion.
Excel workbooks can get corrupted and then all your data could be lost.
Limit it to some reasonable number (less than 100 I would think) and have
multiple workbooks. Make backup copies of each.

With Activeworkbook
.worksheets("Sheet1").Copy After:=.Worksheets(.Worksheets.count)
End With

--
Regards,
Tom Ogilvy

"Corey" wrote in message
...

Is there code to create a new WorkSheet in a WorkBook and have it a
duplicate of another WorkSheet ?
Is there a limit to how many WorkSheets can be in a WorkBook ? Over time
there may be 10,000 sheets needed.

I have a costing sheet that i want to set up, but want to be able to

search
through all records to find specific values in a costing sheet.
Is there a formula to search through ALL WorkSheets in the selected cell

for
values that match, and to ONLY display those WorkSheets ?
I want to place a Button on the 1st WorkSheet and IF clicked, it creates a
New WorkSheet COPY of the Costing Sheet template.

How would i go about this?


Corey....




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default Code to Create a new WorkSheet



Thanks for the reply Tom.
Also thatks for the advice on the file size.

Is there a step i can add to this to Re-Name the Sheet a value from a Msg
Box, Instaed of (Sheet1.2.3.4.5 ets) ?

Corey....
"Tom Ogilvy" wrote in message
...
It is limited by memory.

Putting 10000 sheets in a workbook would not be very smart in my opinion.
Excel workbooks can get corrupted and then all your data could be lost.
Limit it to some reasonable number (less than 100 I would think) and have
multiple workbooks. Make backup copies of each.

With Activeworkbook
.worksheets("Sheet1").Copy After:=.Worksheets(.Worksheets.count)
End With

--
Regards,
Tom Ogilvy

"Corey" wrote in message
...

Is there code to create a new WorkSheet in a WorkBook and have it a
duplicate of another WorkSheet ?
Is there a limit to how many WorkSheets can be in a WorkBook ? Over time
there may be 10,000 sheets needed.

I have a costing sheet that i want to set up, but want to be able to

search
through all records to find specific values in a costing sheet.
Is there a formula to search through ALL WorkSheets in the selected cell

for
values that match, and to ONLY display those WorkSheets ?
I want to place a Button on the 1st WorkSheet and IF clicked, it creates
a
New WorkSheet COPY of the Costing Sheet template.

How would i go about this?


Corey....






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code to Create a new WorkSheet


Dim sh as Worksheet
Dim msg as String, sName as String
msg ="Enter a sheet name (no special characters)"
do
sname = InputBox(msg)
if sname = "" then exit sub
On error resume Next
set sh = worksheets(sName)
on error goto 0
msg = "Name already exists, try again: "
loop while not sh is nothing
With Activeworkbook
.worksheets("Sheet1").Copy After:=.Worksheets(.Worksheets.count)
End With
Activesheet.Name = fname

--
Regards,
Tom Ogilvy


"Corey" wrote in message
...


Thanks for the reply Tom.
Also thatks for the advice on the file size.

Is there a step i can add to this to Re-Name the Sheet a value from a Msg
Box, Instaed of (Sheet1.2.3.4.5 ets) ?

Corey....
"Tom Ogilvy" wrote in message
...
It is limited by memory.

Putting 10000 sheets in a workbook would not be very smart in my

opinion.
Excel workbooks can get corrupted and then all your data could be lost.
Limit it to some reasonable number (less than 100 I would think) and

have
multiple workbooks. Make backup copies of each.

With Activeworkbook
.worksheets("Sheet1").Copy After:=.Worksheets(.Worksheets.count)
End With

--
Regards,
Tom Ogilvy

"Corey" wrote in message
...

Is there code to create a new WorkSheet in a WorkBook and have it a
duplicate of another WorkSheet ?
Is there a limit to how many WorkSheets can be in a WorkBook ? Over

time
there may be 10,000 sheets needed.

I have a costing sheet that i want to set up, but want to be able to

search
through all records to find specific values in a costing sheet.
Is there a formula to search through ALL WorkSheets in the selected

cell
for
values that match, and to ONLY display those WorkSheets ?
I want to place a Button on the 1st WorkSheet and IF clicked, it

creates
a
New WorkSheet COPY of the Costing Sheet template.

How would i go about this?


Corey....








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 276
Default Code to Create a new WorkSheet

Thanks again Tom.
Worked like a gem.

Corey....
"Tom Ogilvy" wrote in message
...

Dim sh as Worksheet
Dim msg as String, sName as String
msg ="Enter a sheet name (no special characters)"
do
sname = InputBox(msg)
if sname = "" then exit sub
On error resume Next
set sh = worksheets(sName)
on error goto 0
msg = "Name already exists, try again: "
loop while not sh is nothing
With Activeworkbook
.worksheets("Sheet1").Copy After:=.Worksheets(.Worksheets.count)
End With
Activesheet.Name = sName

--
Regards,
Tom Ogilvy


"Corey" wrote in message
...


Thanks for the reply Tom.
Also thatks for the advice on the file size.

Is there a step i can add to this to Re-Name the Sheet a value from a Msg
Box, Instaed of (Sheet1.2.3.4.5 ets) ?

Corey....
"Tom Ogilvy" wrote in message
...
It is limited by memory.

Putting 10000 sheets in a workbook would not be very smart in my

opinion.
Excel workbooks can get corrupted and then all your data could be lost.
Limit it to some reasonable number (less than 100 I would think) and

have
multiple workbooks. Make backup copies of each.

With Activeworkbook
.worksheets("Sheet1").Copy After:=.Worksheets(.Worksheets.count)
End With

--
Regards,
Tom Ogilvy

"Corey" wrote in message
...

Is there code to create a new WorkSheet in a WorkBook and have it a
duplicate of another WorkSheet ?
Is there a limit to how many WorkSheets can be in a WorkBook ? Over

time
there may be 10,000 sheets needed.

I have a costing sheet that i want to set up, but want to be able to
search
through all records to find specific values in a costing sheet.
Is there a formula to search through ALL WorkSheets in the selected

cell
for
values that match, and to ONLY display those WorkSheets ?
I want to place a Button on the 1st WorkSheet and IF clicked, it

creates
a
New WorkSheet COPY of the Costing Sheet template.

How would i go about this?


Corey....










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
How to create a form to insert a hyerlink.VBA code to create a for karthi Excel Discussion (Misc queries) 0 July 5th 06 11:26 AM
Code Conflicts With Worksheet Change Code Paige Excel Programming 3 March 3rd 06 04:25 PM
Create a newworksheet with VBA code and put VBA code in the new worksheet module ceshelman Excel Programming 4 June 15th 05 04:37 PM
Altering code to reference the worksheet before the active worksheet KimberlyC Excel Programming 8 March 15th 05 10:26 PM
Return to previous worksheet after code pastes in another worksheet? Ron[_28_] Excel Programming 4 September 4th 04 07:52 PM


All times are GMT +1. The time now is 07:15 AM.

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"