Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Worksheet Exists? Invisible Worksheets?

I need to test for the existence of a specific worksheet in the active
workbook.

The sheet name will always be "OldFiles" and I need to create it if is
doesn't exist.

Also, is there a way to make the new sheet ("OldFiles") invisible?

Ken



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Worksheet Exists? Invisible Worksheets?

Hi Ken,

Try:

Sub TestIt()

If Not SheetExists("Oldfiles", ActiveWorkbook) Then
Worksheets.Add
With ActiveSheet
.Name = "OldFiles"
.Visible = xlVeryHidden
End With
End If
End Sub

Function SheetExists(SName As String, _
Optional ByVal WB As Workbook) As Boolean
'Chip Pearson
On Error Resume Next
If WB Is Nothing Then Set WB = ThisWorkbook
SheetExists = CBool(Len(WB.Sheets(SName).Name))
End Function


---
Regards,
Norman



"Ken Loomis" wrote in message
...
I need to test for the existence of a specific worksheet in the active
workbook.

The sheet name will always be "OldFiles" and I need to create it if is
doesn't exist.

Also, is there a way to make the new sheet ("OldFiles") invisible?

Ken





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
most of menus are dimmed and the worksheet is invisible OfficeUser Excel Discussion (Misc queries) 1 September 30th 09 02:27 PM
invisible words or comment in the worksheet. mike Excel Discussion (Misc queries) 0 March 30th 07 06:46 AM
Controls in all worksheets are suddenly invisible Sabba Excel Discussion (Misc queries) 1 October 28th 06 01:51 AM
How to check if a worksheet exists in worksheet collection Raghunandan Excel Programming 2 July 19th 04 06:55 AM
Printing multiple worksheets only if data exists hailnorm Excel Programming 6 January 10th 04 07:09 PM


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