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
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
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" <winken@u-b-kool.com> wrote in message
news:uW2MrBdfFHA.1948@TK2MSFTNGP12.phx.gbl...
>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
>
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks