Bonjour
Je te propose 2 versions :
Private Function TestExistanceVersion Erreur(byval pSheetName as String) as boolean
On Local Error Goto Err_TestExistanceVersion Erreur
dim lObj as object
set lObj=Sheets(pSheetName)
TestExistanceVersion Erreur=True
Exit Function
Err_TestExistanceVersion Erreur:
Err.Clear
On error goto 0
TestExistanceVersion Erreur=False
End function
Private Function TestExistanceVersionBoucle(byval pSheetName as String) as boolean
Dim lObj as Object
For Each lObj in Sheets
If lObj.Name=pSheetName Then
TestExistanceVersionBoucle=True
Exit function
End if
Next
TestExistanceVersionBoucle=False
End function
Ensuite pour faire ton test :
Sub MonTest()
Dim ws As Worksheet
Sheets("Paramètres").Activate
Range("B2").Select
Set Plage = Range("B2:B26")
For Each Cellule In Plage
If Cellule.Value = "" Then
If TestExistance*(Cellule.Value)=False Then '=False peut être remplacé par l'opératuer Not
Cellule.Value.Delete
End If
End If
Next Cellule
End Sub
Je pense que c'est tout bon, je reste à l'écoute.
Dans Word, j'Excel. (juste pour la citation)
VB (6, .NET1&2), C++, C#.Net1
Mon site