LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Add sheet and name it unless it already exists

On Saturday, May 11, 2013 12:49:22 PM UTC-7, joeu2004 wrote:
"Howard" wrote:

On Saturday, May 11, 2013 9:59:40 AM UTC-7, joeu2004 wrote:


So even if we repeatedly delete, then add one worksheet,


eventually the add will fail. No to worry. IIRC, that


limit is around 10,000.


[....]

Makes me wonder what project would ever require a number


of sheets that massive. Say even 300 to 600...?




You misread. I did not say the limit is 10,000 worksheets. I said that we

"repeatedly delete, then add __one__ worksheet".



It is not uncommon to create temporary worksheets, then delete them. Some

operations are best performed by Excel instead of VBA. And it is not

uncommon do that repeatedly in an algorithm.



FYI, the limit is 10,915 in Excel 2010. And I can hit that limit in a loop

that requires less than 20 sec on my (ancient) computer.



Arguably, it might be better to create one temporary worksheet and use

Activesheet.UsedRange.Clear and perhaps some additional operations. But

that depends on why we are creating temporary worksheets in the first place.

Sometimes it is faster and more reliable to delete and add a new worksheet.



The more likely limitation that your algorithm might hit is due to memory.

As I mentioned before, Excel has an arbitrary limit that might be

significantly less than the computer memory.


So it is a code repetition issue rather than say... cataloging all the grains of sand on the beaches of California with a serial number, each in a separate cell.

Does that happen very often? I don't recall seeing posts looking for solutions around that issue. However, I mostly only read posts that I have some idea of what they are talking about. And that would be never-never land to this
low-hanging-fruit-only lurker.

Howard







 
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
Rename sheet if current sheet name exists Ron5440 Excel Programming 7 January 7th 10 08:55 PM
If Sheet Exists Q Sean Excel Programming 6 March 5th 08 11:28 AM
If the sheet exists...., then Darin Kramer Excel Programming 5 August 13th 07 04:05 PM
If sheet exists, then... Darin Kramer Excel Programming 9 September 12th 06 01:22 PM
How can I know if a sheet exists ? Ben.C Excel Programming 3 December 29th 03 09:36 AM


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