Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

indice

2 réponses
Avatar
Eddy Maue
comment détecter que l'indice n'appartient pas à la sélection ?

Sub CréerFeuille()
ltrouver = False


' pour une plage de cellules sélectionner

For Each fn In ActiveWindow.RangeSelection
If fn.Text = "" = False Then


' If VarType(Sheets(fn.Text)) < CInt(2) Then


' vérifier si la feuille existe
If IsNull(Sheets(fn.Text)) Then
ActiveWorkbook.Sheets.Add
after:=Worksheets(Worksheets.Count)

End If
End If

Next fn

Sheets.Select


eddy a+

2 réponses

Avatar
JB
Bonjour,

Sub essai()
If Not ExisteFeuille("xxxx") Then
Sheets.Add
ActiveSheet.Name = "xxxx"
End If
End Sub

Function ExisteFeuille(f) As Boolean
Application.Volatile
On Error Resume Next
Err = 0
temp = Sheets(UCase(f)).[A1]
If Err = 0 Then ExisteFeuille = True Else ExisteFeuille = False
End Function

Function ExisteFeuille2(f) As Boolean
i = 1
For i = 1 To Sheets.Count
If UCase(f) = UCase(Sheets(i).Name) Then
ExisteFeuille2 = True
End If
Next i
End Function

JB



comment détecter que l'indice n'appartient pas à la sélection ?

Sub CréerFeuille()
ltrouver = False


' pour une plage de cellules sélectionner

For Each fn In ActiveWindow.RangeSelection
If fn.Text = "" = False Then


' If VarType(Sheets(fn.Text)) < CInt(2) Then


' vérifier si la feuille existe
If IsNull(Sheets(fn.Text)) Then
ActiveWorkbook.Sheets.Add
after:=Worksheets(Worksheets.Count)

End If
End If

Next fn

Sheets.Select


eddy a+


Avatar
Eddy Maue
Merci et bonsoir,

JB submitted this idea :
Bonjour,

Sub essai()
If Not ExisteFeuille("xxxx") Then
Sheets.Add
ActiveSheet.Name = "xxxx"
End If
End Sub

Function ExisteFeuille(f) As Boolean
Application.Volatile
On Error Resume Next
Err = 0
temp = Sheets(UCase(f)).[A1]
If Err = 0 Then ExisteFeuille = True Else ExisteFeuille = False
End Function

Function ExisteFeuille2(f) As Boolean
i = 1
For i = 1 To Sheets.Count
If UCase(f) = UCase(Sheets(i).Name) Then
ExisteFeuille2 = True
End If
Next i
End Function

JB


comment détecter que l'indice n'appartient pas à la sélection ?

Sub CréerFeuille()
ltrouver = False

' pour une plage de cellules sélectionner

For Each fn In ActiveWindow.RangeSelection
If fn.Text = "" = False Then

' If VarType(Sheets(fn.Text)) < CInt(2) Then

' vérifier si la feuille existe
If IsNull(Sheets(fn.Text)) Then
ActiveWorkbook.Sheets.Add
after:=Worksheets(Worksheets.Count)

End If
End If

Next fn

Sheets.Select

eddy a+