Thread
:
test if a sheet exist (with the name) ?
View Single Post
#
5
Posted to microsoft.public.excel.programming
LoloSoft
external usenet poster
Posts: 4
test if a sheet exist (with the name) ?
Hi, Bob,
thanks for the fast response !.
--
Laurent.
--
Laurent.
"Bob Phillips" a écrit dans le message
de news:
...
Laurent,
Here is some code
Sub test()
If Not SheetExists("ABC") Then
ActiveWorkbook.Worksheets.Add after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = "ABC"
End If
End Sub
Function SheetExists(Filename As String)
Dim oSh As Worksheet
On Error Resume Next
Set oSh = ActiveWorkbook.Worksheets(Filename)
On Error GoTo 0
SheetExists = Not oSh Is Nothing
End Function
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"LoloSoft" wrote in message
...
Hi,
i'm looking for a way to know if a sheet exist with the name (ex :
"01J")
if it doesn't exist , i have to create it ...
thanks for any help.
------
Laurent.
Reply With Quote
LoloSoft
View Public Profile
Find all posts by LoloSoft