1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| Function FeuilleExiste1(sNomFeuille As String, Optional Wkb As Workbook = Nothing) As Boolean
Dim Ws As Worksheet
FeuilleExiste1 = False
If Wkb Is Nothing Then
Set Wkb = ThisWorkbook
End If
For Each Ws In Wkb.Worksheets
If Ws.Name = sNomFeuille Then
FeuilleExiste1 = True
Set Wkb = Nothing
Exit For
End If
Next Ws
Set Wkb = Nothing
End Function
Private Function FeuilleExiste2(ByVal sNom As String) As Boolean
On Error Resume Next
FeuilleExiste2 = Sheets(sNom).Name <> ""
Err.Clear
End Function
Function FeuilleExiste3(sNomFeuille As String) As Boolean
FeuilleExiste3 = Not (IsError(Evaluate("='" & sNomFeuille & "'!A1")))
End Function
Function FeuilleExiste4(NomFeuille As String, Optional Classeur As Workbook = Nothing) As Boolean
Dim Ws As Worksheet
If Classeur Is Nothing Then Set Classeur = ThisWorkbook
For Each Ws In Classeur.Worksheets
If Ws.Name = NomFeuille Then
FeuilleExiste4 = True
Exit For
End If
Next Ws
End Function
Function FeuilleExiste5(ByVal sNom As String) As Boolean
Dim Ws As Worksheet
On Error Resume Next
Set Ws = Worksheets(sNom)
If Err.Number <> 0 Then FeuilleExiste5 = False Else FeuilleExiste5 = True
End Function
Function FeuilleExiste6(sFeuille As String) As Boolean
FeuilleExiste6 = Evaluate("ISREF('" & sFeuille & "'!A1)")
End Function |